mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
parent
3af67f5565
commit
222084f704
@ -42,6 +42,14 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
showEverToast() {
|
||||
Toast({
|
||||
message: 'toast的内容',
|
||||
selector: '#zan-toast-test',
|
||||
timeout: -1
|
||||
});
|
||||
},
|
||||
|
||||
showLoading() {
|
||||
Toast.loading({
|
||||
message: '加载中',
|
||||
|
@ -25,6 +25,10 @@
|
||||
只显示图标的toast
|
||||
</zan-button>
|
||||
|
||||
<zan-button bind:btnclick="showEverToast">
|
||||
不消失的的toast
|
||||
</zan-button>
|
||||
|
||||
<zan-button bind:btnclick="showLoading">
|
||||
显示 Loading
|
||||
</zan-button>
|
||||
|
@ -52,4 +52,4 @@ Toast.loading({
|
||||
| type | 提示类型 | String | - | loading success fail |
|
||||
| icon | toast 显示图标,可以用 icon 里面支持的所有图标 | String | - | - |
|
||||
| image | toast 显示图标,为图片的链接,传入此值后会覆盖 icon 值 | String | - | |
|
||||
| timeout | toast 显示时间,小于0则会一直显示,需要手动调用 clearZanToast 清除 | Number | - | |
|
||||
| timeout | toast 显示时间,小于0则会一直显示,需要手动调用 Toast.clear 清除 | Number | - | |
|
||||
|
@ -57,9 +57,14 @@ function Toast(optionsOrMsg, pageCtx) {
|
||||
show: true
|
||||
});
|
||||
|
||||
const timeoutId = setTimeout(() => {
|
||||
toastCtx.clear();
|
||||
}, parsedOptions.timeout || 3000);
|
||||
let timeoutId = 0;
|
||||
|
||||
if (parsedOptions.timeout >= 0) {
|
||||
timeoutId = setTimeout(() => {
|
||||
toastCtx.clear();
|
||||
}, parsedOptions.timeout || 3000);
|
||||
}
|
||||
|
||||
|
||||
timeoutData = {
|
||||
timeoutId,
|
||||
|
Loading…
x
Reference in New Issue
Block a user