From af81912210d8e053fb356530787627b11361bb3b Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 7 Dec 2020 20:58:40 +0800 Subject: [PATCH] docs(Stepper): fix async change demo (#7703) --- src/stepper/README.md | 3 ++- src/stepper/README.zh-CN.md | 4 ++-- src/stepper/demo/index.vue | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) 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);