diff --git a/src/calendar/README.zh-CN.md b/src/calendar/README.zh-CN.md index 14504c0be..648525321 100644 --- a/src/calendar/README.zh-CN.md +++ b/src/calendar/README.zh-CN.md @@ -176,7 +176,7 @@ export default { if (date === 1) { day.topInfo = '劳动节'; } else if (date === 4) { - day.topInfo = '五四青年节'; + day.topInfo = '青年节'; } else if (date === 11) { day.text = '今天'; } diff --git a/src/calendar/demo/index.vue b/src/calendar/demo/index.vue index 42a834a41..4bc9ebed2 100644 --- a/src/calendar/demo/index.vue +++ b/src/calendar/demo/index.vue @@ -122,7 +122,7 @@ export default { out: '离店', today: '今天', laborDay: '劳动节', - youthDay: '五四青年节', + youthDay: '青年节', calendar: '日历', maxRange: '日期区间最大范围', selectCount: count => `选择了 ${count} 个日期`, diff --git a/src/calendar/index.js b/src/calendar/index.js index 98f5e9660..e335d7274 100644 --- a/src/calendar/index.js +++ b/src/calendar/index.js @@ -135,13 +135,7 @@ export default createComponent({ watch: { type: 'reset', - - value(val) { - if (val) { - this.initRect(); - this.scrollIntoView(); - } - }, + value: 'init', defaultDate(val) { this.currentDate = val; @@ -150,10 +144,11 @@ export default createComponent({ }, mounted() { - if (this.value || !this.poppable) { - this.initRect(); - this.scrollIntoView(); - } + this.init(); + }, + + activated() { + this.init(); }, methods: { @@ -163,7 +158,11 @@ export default createComponent({ this.scrollIntoView(); }, - initRect() { + init() { + if (this.poppable && !this.value) { + return; + } + this.$nextTick(() => { // add Math.floor to avoid decimal height issues // https://github.com/youzan/vant/issues/5640 @@ -172,6 +171,7 @@ export default createComponent({ ); this.onScroll(); }); + this.scrollIntoView(); }, // scroll to current month