diff --git a/src/stepper/README.md b/src/stepper/README.md index 70310bb2a..ca8f308f0 100644 --- a/src/stepper/README.md +++ b/src/stepper/README.md @@ -88,7 +88,8 @@ export default { onChange(value) { Toast.loading({ forbidClick: true }); - setTimeout(() => { + clearTimeout(this.timer); + this.timer = setTimeout(() => { Toast.clear(); this.value = value; }, 500); diff --git a/src/stepper/README.zh-CN.md b/src/stepper/README.zh-CN.md index 51759683e..6ddcbb535 100644 --- a/src/stepper/README.zh-CN.md +++ b/src/stepper/README.zh-CN.md @@ -110,9 +110,9 @@ export default { onChange(value) { Toast.loading({ forbidClick: true }); - setTimeout(() => { + clearTimeout(this.timer); + this.timer = setTimeout(() => { Toast.clear(); - // 注意此时修改 value 后会再次触发 change 事件 this.value = value; }, 500); diff --git a/src/stepper/demo/index.vue b/src/stepper/demo/index.vue index 7119ee440..be24bb152 100644 --- a/src/stepper/demo/index.vue +++ b/src/stepper/demo/index.vue @@ -91,7 +91,8 @@ export default { onChange(value) { this.$toast.loading({ forbidClick: true }); - setTimeout(() => { + clearTimeout(this.timer); + this.timer = setTimeout(() => { this.stepper6 = value; this.$toast.clear(); }, 500);