Skip to content

Commit

Permalink
docs: change tab's 'Before Change' into a real async function (#12693)
Browse files Browse the repository at this point in the history
  • Loading branch information
gxy5202 committed Mar 16, 2024
1 parent 39291ee commit 942b190
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/vant/src/tab/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export default {

// async
return new Promise((resolve) => {
resolve(index !== 3);
setTimeout(() => resolve(index !== 3), 1000);
});
};

Expand Down
2 changes: 1 addition & 1 deletion packages/vant/src/tab/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export default {
// 返回 Promise 来执行异步逻辑
return new Promise((resolve) => {
// 在 resolve 函数中返回 true 或 false
resolve(index !== 3);
setTimeout(() => resolve(index !== 3), 1000);
});
};

Expand Down
2 changes: 1 addition & 1 deletion packages/vant/src/tab/demo/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const beforeChange = (name: number) => {
return false;
}
return new Promise<boolean>((resolve) => {
resolve(name !== 3);
setTimeout(() => resolve(name !== 3), 1000);
});
};
</script>
Expand Down

0 comments on commit 942b190

Please sign in to comment.