fix(Calendar): row-height not work

This commit is contained in:
陈嘉涵
2019-12-25 16:13:43 +08:00
committed by neverland
parent 51c4dc180b
commit d9da405b95
3 changed files with 28 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
import { createNamespace } from '../../utils';
import { t, bem, compareDay, formatMonthTitle } from '../utils';
import { t, bem, compareDay, formatMonthTitle, ROW_HEIGHT } from '../utils';
import { getMonthEndDay } from '../../datetime-picker/utils';
const [createComponent] = createNamespace('calendar-month');
@@ -123,6 +123,20 @@ export default createComponent({
}
},
getDayStyle(index) {
const style = {};
if (index === 0) {
style.marginLeft = `${(100 * this.offset) / 7}%`;
}
if (this.rowHeight !== ROW_HEIGHT) {
style.height = `${this.rowHeight}px`;
}
return style;
},
genTitle() {
if (this.showTitle) {
return <div class={bem('month-title')}>{this.title}</div>;
@@ -148,13 +162,7 @@ export default createComponent({
genDay(item, index) {
const { type } = item;
let style;
if (index === 0) {
style = {
marginLeft: `${(100 * this.offset) / 7}%`
};
}
const style = this.getDayStyle(index);
const onClick = () => {
if (type !== 'disabled') {