mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
36 lines
705 B
JavaScript
36 lines
705 B
JavaScript
import Vue from 'vue';
|
|
import ImagePreview from './image-preview';
|
|
|
|
let instance;
|
|
|
|
const ImagePreviewConstructor = Vue.extend(ImagePreview);
|
|
|
|
const initInstance = () => {
|
|
/* istanbul ignore if */
|
|
if (Vue.prototype.$isServer) return;
|
|
instance = new ImagePreviewConstructor({
|
|
el: document.createElement('div')
|
|
});
|
|
};
|
|
|
|
var ImagePreviewBox = images => {
|
|
/* istanbul ignore if */
|
|
if (Vue.prototype.$isServer) return;
|
|
if (!instance) {
|
|
initInstance();
|
|
}
|
|
|
|
/* istanbul ignore else */
|
|
if (!instance.value) {
|
|
instance.images = images;
|
|
|
|
document.body.appendChild(instance.$el);
|
|
|
|
Vue.nextTick(() => {
|
|
instance.value = true;
|
|
});
|
|
}
|
|
};
|
|
|
|
export default ImagePreviewBox;
|