模仿饿了么UI设计全局消息框
2018-10-04 本文已影响0人
XinZhu_8163
import MessageBox from 'XXX.vue'
let MessageConstructor = Vue.extend(MessageBox);
const Message = function (options) {
let options = {
data:options
}
let instances = MessageConstructor(options);
instances.vm = instances .$mount();
document.body.appendChild(instances.vm.$el);
return instance.vm;
}
/***
删除组件
***/
destroyElement: function destroyElement() {
//this.$el.addEventListener('transitionend', this.destroyElement);
this.$el.removeEventListener('transitionend', this.destroyElement);
this.$destroy(true);
this.$el.parentNode.removeChild(this.$el);
}