mint UI MessageBox 使用


一、全局注冊

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;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM