参数及用法
参数:
接收2个props
1、text:toast展示所需文本
2、icon:toast展示所需icon
额外参数:接收duration参数:toast展示时长
用法:
import Vue from "vue"; import ShowToast from "common/toast/toast.js"; Vue.prototype.$Toast = ShowToast;
1、任意地方可直接调用,传入对应参数即可,如:
this.$Toast({ text: "未完成提示", icon: "error", duration: 1500 });
2、默认不传icon,icon值为props的default,如:
this.$Toast({ text: "成功提示", duration: 1500 });