123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- 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
|