this.$ toast.clear()会清除所有的 toast。
- 需要同时使用多个 toast 时需要增加,
this.$toast.allowMultiple
- 设置duration: 展示时长(ms),值为 0 时,toast 不会消失
mounted(){
this.$toast.allowMultiple();
},
methods:{
submit(){
const toast1 = this.$toast.loading({
message: '加载中 ...',
forbidClick: true,
loadingType: 'circular',
duration: 0
});
getInfo().then(res => {
toast1.clear();
}, err => {
toast1.clear();
});
const toast2 = this.$toast.loading({
message: '加载中 ...',
forbidClick: true,
loadingType: 'circular',
duration: 0
});
getInfo().then(res => {
toast2.clear();
}, err => {
toast2.clear();
});
}
}