From b9dbb1bc8a7cb14038f03e658624d804abdb1bf1 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Mon, 7 Sep 2020 09:54:45 +0800 Subject: [PATCH] fix(Calendar): color prop not work --- src/calendar/components/Day.js | 47 +++++++++++++++------------------- 1 file changed, 21 insertions(+), 26 deletions(-) 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()}
); };