vue-toast-response
vue 响应式 Toast
安装
yarn add vue-toast-response
or
npm i vue-toast-response
在线演示
http://null_639_5368.gitee.io/vue-toast-response
使用
// 1.1 main.js 注册
import 'vue-toast-response/maybe/vue-toast-response.css'
import VTS from 'vue-toast-response'
Vue.use(VTS)
// 1.2 vue文件函数式调用
this.$mResToast({
type: type,
msg: `显示${type}信息`,
duration: 3000,
isIcon: false, // 控制是否显示图标 默认显示
onClose () {
console.log('message fn')
}
})
or
this.$mResToast.success([msg]); // 成功提示
this.$mResToast.error([msg]); // 错误提示
this.$mResToast.info([msg]); // 信息提示
this.$mResToast.warning([msg]); // 警告提示
this.$mResToast.loading() // load开始
this.$mResToast.close() // load结束
// 1.3 非vue文件(例如axios全局拦截提示)
import VTS from 'vue-toast-response'
let { mResToast } = VTS
mResToast.error('非vue文件调用')
赞助
万分感谢各位,作者也就 2 年经验以后多加努力。