fix(Calendar): should only scroll calendar body when inited (#6926)

This commit is contained in:
neverland
2020-08-02 16:49:57 +08:00
committed by GitHub
parent 81de225e69
commit 39c6637894
4 changed files with 15 additions and 30 deletions
+11 -6
View File
@@ -1,4 +1,5 @@
import { createNamespace } from '../../utils';
import { setScrollTop } from '../../utils/dom/scroll';
import {
t,
bem,
@@ -107,12 +108,16 @@ export default createComponent({
return this.height;
},
scrollIntoView() {
if (this.showSubtitle) {
this.$refs.days.scrollIntoView();
} else {
this.$refs.month.scrollIntoView();
}
scrollIntoView(body) {
const { days, month } = this.$refs;
const el = this.showSubtitle ? days : month;
const scrollTop =
el.getBoundingClientRect().top -
body.getBoundingClientRect().top +
body.scrollTop;
setScrollTop(body, scrollTop);
},
getMultipleDayType(day) {