fix: table expandIcon not work #3013

pull/3067/head
tangjinzhou 2020-10-30 15:29:24 +08:00
parent 5dbcba196f
commit 323647114d
2 changed files with 7 additions and 2 deletions

View File

@ -903,7 +903,10 @@ export default defineComponent({
: item, : item,
); );
}, },
renderExpandIcon(prefixCls) { renderExpandIcon(prefixCls: string) {
if (this.expandIcon) {
return this.expandIcon;
}
return ({ expandable, expanded, needIndentSpaced, record, onExpand }) => { return ({ expandable, expanded, needIndentSpaced, record, onExpand }) => {
if (expandable) { if (expandable) {
return ( return (
@ -916,7 +919,7 @@ export default defineComponent({
[`${prefixCls}-row-collapsed`]: !expanded, [`${prefixCls}-row-collapsed`]: !expanded,
[`${prefixCls}-row-expanded`]: expanded, [`${prefixCls}-row-expanded`]: expanded,
})} })}
onClick={event => { onClick={(event: Event) => {
onExpand(record, event); onExpand(record, event);
}} }}
aria-label={expanded ? locale.collapse : locale.expand} aria-label={expanded ? locale.collapse : locale.expand}

View File

@ -69,6 +69,7 @@ const Table = defineComponent({
title: slotTitle, title: slotTitle,
footer: slotFooter, footer: slotFooter,
expandedRowRender = props.expandedRowRender, expandedRowRender = props.expandedRowRender,
expandIcon,
} = $slots; } = $slots;
title = title || slotTitle; title = title || slotTitle;
footer = footer || slotFooter; footer = footer || slotFooter;
@ -78,6 +79,7 @@ const Table = defineComponent({
title, title,
footer, footer,
expandedRowRender, expandedRowRender,
expandIcon: this.$props.expandIcon || expandIcon,
}; };
return <T {...tProps} ref="table" />; return <T {...tProps} ref="table" />;
}, },