这次给大家带来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代码
升级通知
分享
{{title}}
{{ranking}}
引用页面代码
相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
推荐阅读:










