mint-ui之toast使用(messagebox,indicator同理)


toast為消息提示框,支持自定義位置、持續時間和樣式。

一,注意事項

方法1   引入整個 Mint UI 組件,並需要再次單獨引入Toast組件

  Toast,它並不是一個全局變量,需要先引入 import { Toast } from 'mint-ui' 再使用

  Toast('提示信息');

方法2 引入整個 Mint UI 不再單獨引入Toast組件

     this.$toast('提示信息');

   官方文檔沒寫,但看下源碼的index.js就找得到

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

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

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

   (所有引用插件的源碼都在node_modules下面)

二,用法

   1.基本用法

    Toast('提示信息');

  2.多配置用法

  

let instance = Toast({ message: '提示', // 提示內容分
       position: 'bottom', //提示框位置
       duration: 5000 , //持續時間(毫秒),若為 -1 則不會自動關閉
       iconClass: 'icon icon-success' , //icon 圖標的類名
       className:'addClass'   //Toast 的類名。可以為其添加樣式
});    
setTimeout(() => {
instance.close()
}, 2000)

 

 

 

 


免責聲明!

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



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