Merge branch 'master' of github.com:9th-js/wcui
commit
b9a01d11ff
|
@ -262,15 +262,21 @@ class ImagePreview extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImagePreview.reg('image-preview')
|
ImagePreview.reg('image-preview')
|
||||||
const instance = new ImagePreview()
|
|
||||||
document.body.appendChild(instance)
|
let instance = null
|
||||||
|
|
||||||
window.imagePreview = function (options) {
|
window.imagePreview = function (options) {
|
||||||
|
if (!instance) {
|
||||||
|
instance = new ImagePreview()
|
||||||
|
document.body.appendChild(instance)
|
||||||
|
}
|
||||||
|
|
||||||
if (Array.isArray(options)) {
|
if (Array.isArray(options)) {
|
||||||
instance.list = options
|
instance.list = options
|
||||||
} else {
|
} else {
|
||||||
Object.assign(instance, options)
|
Object.assign(instance, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.visible = true
|
instance.visible = true
|
||||||
return instance
|
return instance
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue