diff --git a/src/calendar/components/Day.js b/src/calendar/components/Day.js index e7e6fa14c..73a8d4b3c 100644 --- a/src/calendar/components/Day.js +++ b/src/calendar/components/Day.js @@ -17,7 +17,7 @@ export default createComponent({ setup(props, { emit }) { const style = computed(() => { - const { type, index, color, offset, rowHeight } = props; + const { item, index, color, offset, rowHeight } = props; const style = { height: rowHeight, }; @@ -27,7 +27,7 @@ export default createComponent({ } if (color) { - switch (type) { + switch (item.type) { case 'end': case 'start': case 'start-end': @@ -45,14 +45,14 @@ export default createComponent({ }); const onClick = () => { - if (props.type !== 'disabled') { + if (props.item.type !== 'disabled') { emit('click', props.item); } }; - return () => { + const renderContent = () => { const { item, color, rowHeight } = props; - const { type, topInfo, bottomInfo } = item; + const { type, text, topInfo, bottomInfo } = item; const TopInfo = topInfo &&
{topInfo}
; @@ -60,42 +60,37 @@ export default createComponent({
{bottomInfo}
); + const Nodes = [TopInfo, text, BottomInfo]; + if (type === 'selected') { return (
-
- {TopInfo} - {item.text} - {BottomInfo} -
+ {Nodes}
); } + return Nodes; + }; + + return () => { + const { type, className } = props.item; return (
- {TopInfo} - {item.text} - {BottomInfo} + {renderContent()}
); };