|
@@ -0,0 +1,24 @@
|
|
|
+import ImgPreviewComponent from './ImgPreview'
|
|
|
+
|
|
|
+const ImgPreview = {}
|
|
|
+
|
|
|
+ImgPreview.install = Vue => {
|
|
|
+ const ImgConstructor = Vue.extend(ImgPreviewComponent)
|
|
|
+
|
|
|
+ const instance = new ImgConstructor()
|
|
|
+
|
|
|
+ instance.$mount(document.createElement('div'))
|
|
|
+
|
|
|
+ document.body.appendChild(instance.$el)
|
|
|
+
|
|
|
+ Vue.prototype.$imgPreview = (e) => {
|
|
|
+ instance.target = e.currentTarget
|
|
|
+ instance.imgs = instance.target.getAttribute('data-img').split(',')
|
|
|
+ for(let i = 0;i<instance.imgs.length;i++){
|
|
|
+ if(!instance.imgs[i]) instance.imgs.splice(i)
|
|
|
+ }
|
|
|
+ instance.isShowImageDialog = true
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export default ImgPreview
|