这次给大家带来vue.extend实现alert模态框弹窗步骤详解,vue.extend实现alert模态框弹窗的注意事项有哪些,下面就是实战案例,一起来看一下。
alert.js文件代码import Vue from 'vue'
// 创建组件构造器
const alertHonor = Vue.extend(require('./alert.vue'));
var currentMsg = {callback:function(){
}}
export default function(options){
var alertComponent = new alertHonor({el: document.createElement('p')});
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代码
升级通知
分享