fix(Calendar): row-height not work

This commit is contained in:
陈嘉涵
2019-12-26 19:59:08 +08:00
committed by neverland
parent 51c4dc180b
commit d9da405b95
3 changed files with 28 additions and 12 deletions
+9 -4
View File
@@ -6,7 +6,9 @@ import {
getNextDay,
compareDay,
compareMonth,
createComponent
createComponent,
ROW_HEIGHT,
RENDER_OFFSET
} from './utils';
import Button from '../button';
@@ -38,7 +40,7 @@ export default createComponent({
},
rowHeight: {
type: Number,
default: 64
default: ROW_HEIGHT
},
showMark: {
type: Boolean,
@@ -98,10 +100,13 @@ export default createComponent({
}
},
// calculate the position of the elements
// and find the elements that needs to be rendered
onScroll() {
const { body, months } = this.$refs;
const top = getScrollTop(body);
const bottom = top + this.bodyHeight;
const scrollTop = getScrollTop(body);
const top = scrollTop - RENDER_OFFSET;
const bottom = scrollTop + this.bodyHeight + RENDER_OFFSET;
const heights = months.map(item => item.height);
let height = 0;