本文通过Vue.extend创建组件构造器的方法写弹窗组件,供大家参考,具体内容如下
var currentMsg = {callback:function(){
}}
}}
export default function(options){
var alertComponent = new alertHonor({el: document.createElement('div')});
alertComponent.title = options.title;
alertComponent.ranking = options.ranking;
// 把alertHonor.vue加入body中
alertComponent.$appendTo(document.body);
// 回调函数
alertComponent.callback = function(action) {
if (action == 'share') {
options.share();
}
};
}
alert.vue代码
<div class="jb51code">
<pre class="brush:xhtml;">
Box" @click="alertHonorClick">