Skip to content

feat(table): support expandIcon slot #4448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions components/table/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,9 @@ export default {
getPopupContainer: contextGetPopupContainer,
transformCellText,
}) {
const { showHeader, locale, getPopupContainer, ...restProps } = getOptionProps(this);
const { showHeader, locale, getPopupContainer, expandIcon, ...restProps } = getOptionProps(
this,
);
const data = this.getCurrentPageData();
const expandIconAsCell = this.expandedRowRender && this.expandIconAsCell !== false;

Expand Down Expand Up @@ -1190,7 +1192,7 @@ export default {
const vcTableProps = {
key: 'table',
props: {
expandIcon: this.renderExpandIcon(prefixCls),
expandIcon: expandIcon || this.renderExpandIcon(prefixCls),
...restProps,
customRow: (record, index) => this.onRow(prefixCls, record, index),
components: this.sComponents,
Expand Down
2 changes: 2 additions & 0 deletions components/table/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const Table = {
title: slotTitle,
footer: slotFooter,
expandedRowRender = props.expandedRowRender,
expandIcon = props.expandIcon,
} = $scopedSlots;
title = title || slotTitle;
footer = footer || slotFooter;
Expand All @@ -122,6 +123,7 @@ const Table = {
title,
footer,
expandedRowRender,
expandIcon,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$props.expandIcon 优先级更高吧

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

},
on: getListeners(this),
};
Expand Down