mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(Toast): shoud watch duration #7394
This commit is contained in:
parent
d7a944e391
commit
bd1ed1c1ce
@ -94,17 +94,14 @@ export default createComponent({
|
||||
|
||||
watch([() => props.show, () => props.forbidClick], toggleClickable);
|
||||
|
||||
watch(
|
||||
() => props.show,
|
||||
(value) => {
|
||||
watch([() => props.show, () => props.duration], () => {
|
||||
clearTimer();
|
||||
if (value && props.duration > 0) {
|
||||
if (props.show && props.duration > 0) {
|
||||
timer = setTimeout(() => {
|
||||
emit('update:show', false);
|
||||
}, props.duration);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
onMounted(toggleClickable);
|
||||
onUnmounted(toggleClickable);
|
||||
|
Loading…
x
Reference in New Issue
Block a user