From 783e30361fb0584785758481bdbdd142d20253cc Mon Sep 17 00:00:00 2001 From: mypridelife <35483539+mypridelife@users.noreply.github.com> Date: Fri, 3 Jan 2020 16:06:52 +0800 Subject: [PATCH] docs(Calendar): update calendar examples #5444 (#5465) Update english doc --- src/calendar/README.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/calendar/README.md b/src/calendar/README.md index b1d21582d..781cd3c2b 100644 --- a/src/calendar/README.md +++ b/src/calendar/README.md @@ -35,16 +35,15 @@ export default { }, methods: { - formatDate() { + formatDate(date) { return `${date.getMonth() + 1}/${date.getDate()}`; }, onConfirm(date) { - const [start, end] = date; this.show = false; - this.date = `${this.formatDate(start)} - ${this.formatDate(end)}`; + this.date = this.formatDate(date); } } -} +}; ``` ### Select Date Range @@ -61,17 +60,22 @@ You can select a date range after setting `type` to` range`. In range mode, the export default { data() { return { - show: false, - date: [] + date: '', + show: false }; }, + methods: { + formatDate(date) { + return `${date.getMonth() + 1}/${date.getDate()}`; + }, onConfirm(date) { + const [start, end] = date; this.show = false; - this.date = date; + this.date = `${this.formatDate(start)} - ${this.formatDate(end)}`; } } -} +}; ``` ### Quick Select