import Avatar from './index.vue' import i18n from '@/util/lang/lang' 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 } }, i18n }) 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 } }, i18n }) document.body.appendChild(instance.$el) } } export default Avatar