mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 01:54:48 +00:00
fix(Toast): shoud watch duration #7394
This commit is contained in:
@@ -94,17 +94,14 @@ export default createComponent({
|
||||
|
||||
watch([() => props.show, () => props.forbidClick], toggleClickable);
|
||||
|
||||
watch(
|
||||
() => props.show,
|
||||
(value) => {
|
||||
clearTimer();
|
||||
if (value && props.duration > 0) {
|
||||
timer = setTimeout(() => {
|
||||
emit('update:show', false);
|
||||
}, props.duration);
|
||||
}
|
||||
watch([() => props.show, () => props.duration], () => {
|
||||
clearTimer();
|
||||
if (props.show && props.duration > 0) {
|
||||
timer = setTimeout(() => {
|
||||
emit('update:show', false);
|
||||
}, props.duration);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
onMounted(toggleClickable);
|
||||
onUnmounted(toggleClickable);
|
||||
|
Reference in New Issue
Block a user