import Avatar from './index.vue' Avatar.install = function (Vue, store) { const Constructor = Vue.extend(Avatar) let instance Vue.prototype.$editUserAvatar = (imageUrl = '') => { if (instance) { document.body.removeChild(instance.$el) instance = null } instance = new Constructor({ el: document.createElement('div'), computed: { $store () { return store } }, data () { return { visible: true, imageUrl, isMe: true } } }) document.body.appendChild(instance.$el) } Vue.prototype.$editGroupAvatar = (imageUrl = '') => { if (instance) { document.body.removeChild(instance.$el) instance = null } instance = new Constructor({ el: document.createElement('div'), computed: { $store () { return store } }, data () { return { visible: true, imageUrl, isMe: false } } }) document.body.appendChild(instance.$el) } } export default Avatar