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

View File

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