vue —— Toast 内 加变量

toast正常使用:
在页面内引入:
import { Toast } from 'mint-ui'使用的时候,简单到飞起:
Toast('领取成功');而如果想在toast中加入变量,也很简单:为了提高使用率,找到项目的main.js进行全局引用
import { Toast } from 'mint-ui'Vue.prototype.$toast = Toast
页面内使用不需要单独引用,直接使用就好:
this.$toast({ message: `验证码已发送至${this.userInfo.cellphone}`,
type: "error",
duration: 1000
});
toast里面的message为你想要赋予 toast 的提示文案
type是提示类型
duration为显示时间
具体可以参照mint-ui的说明文档
以上是 vue —— Toast 内 加变量 的全部内容, 来源链接: utcz.com/z/378873.html
