vue.js中烤用法及使用烤弹框的实例代码
1.首先引入
从“万特”导入{吐司}写个小列子
绑定一个点击事件
2.写事件
在方法写方法
showToast() { this .$toast({ message: '今日签到3', }) },3.效果图如下
一个简单的烤提示成就好了
下面通过实例代码看下某视频剪辑软件中使用烤弹框
从呜呜呜。使用(吐司插件)vue。使用(ConfirmPlugin)vue。使用(AlertPlugin)//导入{测试插件、确认插件、警报插件}公用的弹窗(全局变量)vue。原型。show toast=function(showPositionValue,type,text,width='10em'){ this .$ vux。吐司。show({ showpositionvalue : false,text: text,type: type,width: width,position: 'middle' })}//公用警报确认常量消息={ };消息。install=()={ const msg={ alert : config={ let def={ title : '提示,content: '系统异常,请重新登录后再试!按钮文本: '确定} if(配置类型==' string ' | |配置类型==' number '){ Vue .$ vux。警惕。显示(对象。assign(def,{ content : config });}else{ Vue .$ vux。警惕。显示(对象。赋值(def,config));}},确认: config={ let isConfirm=false;let def={ title: '提示,content: '系统异常,请重新登录后再试!确认文本: '确定,取消文本: '取消,onconfirm :()={ isConfirm=true;} } if(配置的类型==='字符串' | |配置的类型==='number'){ Vue .$ vux。确认。显示(对象。assign(def,{ content : config });}else{ Vue .$ vux。确认。显示(对象。赋值(def,config));}/*返回新的承诺(解析,拒绝)={ if(isConfirm){ resolve();} })*/},} Object.entries(消息)。forEach(([method,fn])={ vue。原型[方法]=fn;})}Vue.use(Message)//使用例子_this.confirm({ title: '提示,content: '确定要关闭订单,onConfirm() { console.log('取消订单了');}});总结
以上所述是小编给大家介绍的vue.js中烤用法及使用烤弹框的实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我们网站的支持!
版权声明:vue.js中烤用法及使用烤弹框的实例代码是由宝哥软件园云端程序自动收集整理而来。如果本文侵犯了你的权益,请联系本站底部QQ或者邮箱删除。