首页 > 其他 > 详细

mint UI MessageBox 使用

时间:2019-11-07 00:18:27      阅读:316      评论:0      收藏:0      [点我收藏+]

一、全局注册

1.在main.js中引入

//引入

import { MessageBox } from ‘mint-ui‘;

 
//全局使用,挂载到原型上

Vue.prototype.$messagebox = MessageBox   

 

2.在xxx.vue使用

//alert

this.$messagebox.alert("操作成功").then(action => {
 
});
 
//confirm
 
this.$messagebox.confirm("确定执行此操作?").then(action => {
 
});
 
//prompt
 
this.$messagebox.prompt("请输入你的姓名").then(({ value, action }) => {
 
});
 
二、局部使用
 
1.在xxx.vue文件的script标签中引入
 
import { MessageBox } from ‘mint-ui‘;
 
2.使用
 
//alert
 
MessageBox.alert("确定执行此操作?").then(action => {
 
});
 
//confirm
 
MessageBox.confirm("确定执行此操作?").then(action => {
 
});
 
//prompt
 
MessageBox.prompt("确定执行此操作?").then(({ value, action }) => {
 
});
 

 附加:(toast | indicator | messagebox)三者使用方式一样

Vue.$messagebox = Vue.prototype.$messagebox = MessageBox;

Vue.$toast = Vue.prototype.$toast = Toast;

Vue.$indicator = Vue.prototype.$indicator = Indicator;

mint UI MessageBox 使用

原文:https://www.cnblogs.com/wubaiwan/p/11809071.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!