From 942b190e07a17793ec49d4a432fc12b9f5ac3047 Mon Sep 17 00:00:00 2001 From: Gomi Date: Sat, 16 Mar 2024 11:12:20 +0800 Subject: [PATCH] docs: change tab's 'Before Change' into a real async function (#12693) --- packages/vant/src/tab/README.md | 2 +- packages/vant/src/tab/README.zh-CN.md | 2 +- packages/vant/src/tab/demo/index.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/vant/src/tab/README.md b/packages/vant/src/tab/README.md index f25785d37..522810a60 100644 --- a/packages/vant/src/tab/README.md +++ b/packages/vant/src/tab/README.md @@ -219,7 +219,7 @@ export default { // async return new Promise((resolve) => { - resolve(index !== 3); + setTimeout(() => resolve(index !== 3), 1000); }); }; diff --git a/packages/vant/src/tab/README.zh-CN.md b/packages/vant/src/tab/README.zh-CN.md index ff11ee07a..e9efd2fac 100644 --- a/packages/vant/src/tab/README.zh-CN.md +++ b/packages/vant/src/tab/README.zh-CN.md @@ -231,7 +231,7 @@ export default { // 返回 Promise 来执行异步逻辑 return new Promise((resolve) => { // 在 resolve 函数中返回 true 或 false - resolve(index !== 3); + setTimeout(() => resolve(index !== 3), 1000); }); }; diff --git a/packages/vant/src/tab/demo/index.vue b/packages/vant/src/tab/demo/index.vue index 9964dec0f..3664bceff 100644 --- a/packages/vant/src/tab/demo/index.vue +++ b/packages/vant/src/tab/demo/index.vue @@ -65,7 +65,7 @@ const beforeChange = (name: number) => { return false; } return new Promise((resolve) => { - resolve(name !== 3); + setTimeout(() => resolve(name !== 3), 1000); }); };