From eef8e0b0deaf4f030b74477c81eecb71e7ef4c9b Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Wed, 14 Aug 2024 21:12:06 +0800 Subject: [PATCH] docs(Calendar): fix inconsistencies between the document and "demo" (#13061) --- packages/vant/src/calendar/README.md | 6 ++++-- packages/vant/src/calendar/README.zh-CN.md | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/vant/src/calendar/README.md b/packages/vant/src/calendar/README.md index b1fdbd4af..f47452db6 100644 --- a/packages/vant/src/calendar/README.md +++ b/packages/vant/src/calendar/README.md @@ -43,7 +43,9 @@ export default { const date = ref(''); const show = ref(false); - const formatDate = (date) => `${date.getMonth() + 1}/${date.getDate()}`; + const formatDate = (date) => { + return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`; + }; const onConfirm = (value) => { show.value = false; date.value = formatDate(value); @@ -227,7 +229,7 @@ Use `position` to custom popup position, can be set to `top`、`left`、`right`. When selecting a date range, you can use the `max-range` prop to specify the maximum number of selectable days. ```html - + ``` ### Custom First Day Of Week diff --git a/packages/vant/src/calendar/README.zh-CN.md b/packages/vant/src/calendar/README.zh-CN.md index b3435df46..88730fd5b 100644 --- a/packages/vant/src/calendar/README.zh-CN.md +++ b/packages/vant/src/calendar/README.zh-CN.md @@ -43,7 +43,9 @@ export default { const date = ref(''); const show = ref(false); - const formatDate = (date) => `${date.getMonth() + 1}/${date.getDate()}`; + const formatDate = (date) => { + return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`; + }; const onConfirm = (value) => { show.value = false; date.value = formatDate(value); @@ -231,7 +233,7 @@ export default { 选择日期区间时,可以通过 `max-range` 属性来指定最多可选天数,选择的范围超过最多可选天数时,会弹出相应的提示文案。 ```html - + ``` ### 自定义周起始日