import Vue from 'vue'
import Main from './main.vue'
let AlertConstructor = Vue.extend(Main)
let instance = null
var ShowPicture = function(data) {
    if (typeof data !== 'object') {
        data = { content: '' + data }
    }
    if (instance && instance.visible) {
        Object.keys(data).forEach(function(key) {
            instance[key] = data[key]
        })
    } else {
        instance = new AlertConstructor({
            data: data
        })
        instance.vm = instance.$mount()
        document.body.appendChild(instance.vm.$el)
    }
    return instance.vm
}

ShowPicture.close = function() {
    instance && instance.close()
}
export default ShowPicture