v-img-view
v1.0.2
Published
基于viewerjs的一款图片查看指令,支持方法调用
Downloads
8
Readme
v-img-view
基于viewerjs的一款图片查看指令,支持方法调用
安装
$ npm install --save v-img-view
使用
支持指令和服务,如使用指令需要全局注册
// 全局注册
import viewImagePlugin from 'v-img-view'
Vue.use(viewImagePlugin)
<p v-image-view="imgList">图片查看</p>
<p @click="view">方法调用</p>
import {ImageViewService} from 'v-img-view'
export default {
name: 'App',
data() {
return {
// imgList 支持String 和 Array
imgList: ['http://dummyimage.com/468x100&text=第一张',
'http://dummyimage.com/468x200&text=第二张']
}
},
methods: {
view() {
// 参数目前仅支持 Array
ImageViewService.view(['http://dummyimage.com/468x260&text=方法调用'])
}
}
}