fix(Calendar): subtitle not updated in some cases (#6723)

This commit is contained in:
neverland 2020-07-07 14:44:20 +08:00 committed by GitHub
parent 5793481ba4
commit 89fdbf4729
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -90,11 +90,14 @@ export default createComponent({
},
},
mounted() {
this.height = this.$el.getBoundingClientRect().height;
},
methods: {
getHeight() {
if (!this.height) {
this.height = this.$el.getBoundingClientRect().height;
}
return this.height;
},
scrollIntoView() {
if (this.showSubtitle) {
this.$refs.days.scrollIntoView();

View File

@ -234,7 +234,7 @@ export default createComponent({
const { body, months } = this.$refs;
const top = getScrollTop(body);
const bottom = top + this.bodyHeight;
const heights = months.map((item) => item.height);
const heights = months.map((item) => item.getHeight());
const heightSum = heights.reduce((a, b) => a + b, 0);
// iOS scroll bounce may exceed the range