Skip to content

fix(Table): props passing #6588

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 4 additions & 5 deletions components/table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -668,19 +668,18 @@ const Table = defineComponent({
customFilterDropdown?: any;
default: any;
}>,
setup(_props, { attrs, slots, expose }) {
setup(props, { slots, expose }) {
const table = ref();
expose({
table,
});
return () => {
const props = attrs as TableProps;
const columns = props.columns || convertChildrenToColumns(slots.default?.());
const columns = computed(() => props.columns || convertChildrenToColumns(slots.default?.()));
return (
<InteralTable
ref={table}
{...attrs}
columns={columns || []}
{...props}
columns={columns.value || []}
expandedRowRender={slots.expandedRowRender}
contextSlots={{ ...slots }} // use new object, 否则slot热更新失效,原因需进一步探究
v-slots={slots}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,50 +110,20 @@ exports[`Table.rowSelection render with default selection correctly 1`] = `
<div class="ant-dropdown ant-slide-up-enter ant-slide-up-enter-prepare ant-slide-up-enter-start" style="pointer-events: none; display: none;">
<!---->
<ul class="ant-dropdown-menu ant-dropdown-menu-root ant-dropdown-menu-vertical ant-dropdown-menu-light" role="menu" data-menu-list="true">
<div>
<!---->
<div class="ant-tooltip ant-dropdown-menu-inline-collapsed-tooltip ant-zoom-big-fast-enter ant-zoom-big-fast-enter-prepare ant-zoom-big-fast-enter-start" style="pointer-events: none; display: none;">
<div class="ant-tooltip-content">
<div class="ant-tooltip-arrow"><span class="ant-tooltip-arrow-content"></span></div>
<div class="ant-tooltip-inner" role="tooltip">
<!---->
</div>
</div>
</div>
</div>
<li class="ant-dropdown-menu-item ant-dropdown-menu-item-only-child" data-menu-id="all" aria-disabled="false" role="menuitem" tabindex="-1">
<!----><span class="ant-dropdown-menu-title-content">Select all data</span>
</li>
<div>
<!---->
<div class="ant-tooltip ant-dropdown-menu-inline-collapsed-tooltip ant-zoom-big-fast-enter ant-zoom-big-fast-enter-prepare ant-zoom-big-fast-enter-start" style="pointer-events: none; display: none;">
<div class="ant-tooltip-content">
<div class="ant-tooltip-arrow"><span class="ant-tooltip-arrow-content"></span></div>
<div class="ant-tooltip-inner" role="tooltip">
<!---->
</div>
</div>
</div>
</div>
<!---->
<li class="ant-dropdown-menu-item ant-dropdown-menu-item-only-child" data-menu-id="invert" aria-disabled="false" role="menuitem" tabindex="-1">
<!----><span class="ant-dropdown-menu-title-content">Invert current page</span>
</li>
<div>
<!---->
<div class="ant-tooltip ant-dropdown-menu-inline-collapsed-tooltip ant-zoom-big-fast-enter ant-zoom-big-fast-enter-prepare ant-zoom-big-fast-enter-start" style="pointer-events: none; display: none;">
<div class="ant-tooltip-content">
<div class="ant-tooltip-arrow"><span class="ant-tooltip-arrow-content"></span></div>
<div class="ant-tooltip-inner" role="tooltip">
<!---->
</div>
</div>
</div>
</div>
<!---->
<li class="ant-dropdown-menu-item ant-dropdown-menu-item-only-child" data-menu-id="none" aria-disabled="false" role="menuitem" tabindex="-1">
<!----><span class="ant-dropdown-menu-title-content">Clear all data</span>
</li>
<!---->
<!---->
<!---->
<!--teleport start-->
<!--teleport end-->
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ exports[`Table.sorter renders sorter icon correctly 1`] = `
<thead class="ant-table-thead">
<tr>
<th class="ant-table-cell ant-table-column-has-sorters" tabindex="0" colstart="0" colend="0">
<!---->
<!---->
<div class="ant-table-column-sorters"><span class="ant-table-column-title">Name</span><span class="ant-table-column-sorter ant-table-column-sorter-full"><span class="ant-table-column-sorter-inner"><span role="presentation" aria-label="caret-up" class="anticon anticon-caret-up ant-table-column-sorter-up"><svg focusable="false" class="" data-icon="caret-up" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="0 0 1024 1024"><path d="M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"></path></svg></span><span role="presentation" aria-label="caret-down" class="anticon anticon-caret-down ant-table-column-sorter-down"><svg focusable="false" class="" data-icon="caret-down" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="0 0 1024 1024"><path d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"></path></svg></span></span></span></div>
<!---->
<!---->
</th>
</tr>
</thead>
Expand Down
Loading