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 -<van-calendar type="range" :max-range="3" :style="{ height: '500px' }" /> +<van-calendar type="range" :max-range="3" /> ``` ### 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 -<van-calendar type="range" :max-range="3" :style="{ height: '500px' }" /> +<van-calendar type="range" :max-range="3" /> ``` ### 自定义周起始日