Skip to content

Commit a50684c

Browse files
committed
feat: use renderSlot
1 parent 3610140 commit a50684c

15 files changed

+34
-41
lines changed

components/table/context.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import { computed } from 'vue';
33
import { inject, provide } from 'vue';
44

55
export type ContextSlots = {
6-
emptyText?: (...args: any[]) => void;
7-
expandIcon?: (...args: any[]) => void;
8-
title?: (...args: any[]) => void;
9-
footer?: (...args: any[]) => void;
10-
summary?: (...args: any[]) => void;
11-
bodyCell?: (...args: any[]) => void;
12-
headerCell?: (...args: any[]) => void;
13-
customFilterIcon?: (...args: any[]) => void;
14-
customFilterDropdown?: (...args: any[]) => void;
6+
emptyText?: (...args: any[]) => any;
7+
expandIcon?: (...args: any[]) => any;
8+
title?: (...args: any[]) => any;
9+
footer?: (...args: any[]) => any;
10+
summary?: (...args: any[]) => any;
11+
bodyCell?: (...args: any[]) => any;
12+
headerCell?: (...args: any[]) => any;
13+
customFilterIcon?: (...args: any[]) => any;
14+
customFilterDropdown?: (...args: any[]) => any;
1515
// 兼容 2.x 的 columns slots 配置
16-
[key: string]: (...args: any[]) => void;
16+
[key: string]: (...args: any[]) => any;
1717
};
1818

1919
export type ContextProps = ComputedRef<ContextSlots>;

components/table/demo/ajax.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ This example shows how to fetch and present data from a remote server, and how t
3030
>
3131
<template #bodyCell="{ column, text }">
3232
<template v-if="column.dataIndex === 'name'">{{ text.first }} {{ text.last }}</template>
33-
<template v-else>{{ text }}</template>
3433
</template>
3534
</a-table>
3635
</template>

components/table/demo/basic.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ Simple table with actions.
1717

1818
<template>
1919
<a-table :columns="columns" :data-source="data">
20-
<template #headerCell="{ title, column }">
20+
<template #headerCell="{ column }">
2121
<template v-if="column.key === 'name'">
2222
<span>
2323
<smile-outlined />
2424
Name
2525
</span>
2626
</template>
27-
<template v-else>{{ title }}</template>
2827
</template>
2928

3029
<template #bodyCell="{ column, record }">
@@ -56,7 +55,6 @@ Simple table with actions.
5655
</a>
5756
</span>
5857
</template>
59-
<template v-else>{{ record.name }}</template>
6058
</template>
6159
</a-table>
6260
</template>

components/table/demo/bordered.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Add border, title and footer for table.
2121
<template v-if="column.dataIndex === 'name'">
2222
<a>{{ text }}</a>
2323
</template>
24-
<template v-else>{{ text }}</template>
2524
</template>
2625
<template #title>Header</template>
2726
<template #footer>Footer</template>

components/table/demo/colspan-rowspan.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Table cell supports `colSpan` and `rowSpan` that set in render return object. Wh
2424
<template v-if="column.dataIndex === 'name'">
2525
<a href="javascript:;">{{ text }}</a>
2626
</template>
27-
<template v-else>{{ text }}</template>
2827
</template>
2928
</a-table>
3029
</template>

components/table/demo/custom-filter-panel.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Implement a customized column search example via `customFilterDropdown`.
2222
<template v-if="column.key === 'name'">
2323
<span style="color: #1890ff">Name</span>
2424
</template>
25-
<template v-else>{{ column.title }}</template>
2625
</template>
2726
<template
2827
#customFilterDropdown="{ setSelectedKeys, selectedKeys, confirm, clearFilters, column }"
@@ -70,9 +69,6 @@ Implement a customized column search example via `customFilterDropdown`.
7069
<template v-else>{{ fragment }}</template>
7170
</template>
7271
</span>
73-
<template v-else>
74-
{{ text }}
75-
</template>
7672
</template>
7773
</a-table>
7874
</template>

components/table/demo/edit-cell.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ Table with editable cells.
4141
<a>Delete</a>
4242
</a-popconfirm>
4343
</template>
44-
<template v-else>{{ text }}</template>
4544
</template>
4645
</a-table>
4746
</template>

components/table/demo/ellipsis.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Ellipsis cell content via setting `column.ellipsis`.
2424
<template v-if="column.dataIndex === 'name'">
2525
<a>{{ text }}</a>
2626
</template>
27-
<template v-else>{{ text }}</template>
2827
</template>
2928
</a-table>
3029
</template>

components/table/demo/expand.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ When there's too much information to show and the table can't display all at onc
1818

1919
<template>
2020
<a-table :columns="columns" :data-source="data" :scroll="{ x: 2000 }">
21-
<template #bodyCell="{ column, text }">
21+
<template #bodyCell="{ column }">
2222
<template v-if="column.key === 'action'">
2323
<a>Delete</a>
2424
</template>
25-
<template v-else>{{ text }}</template>
2625
</template>
2726
<template #expandedRowRender="{ record }">
2827
<p style="margin: 0">

components/table/demo/fixed-columns-header.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ A Solution for displaying large amounts of data with long columns.
2525

2626
<template>
2727
<a-table :columns="columns" :data-source="data" :scroll="{ x: 1500, y: 300 }">
28-
<template #bodyCell="{ column, text }">
28+
<template #bodyCell="{ column }">
2929
<template v-if="column.key === 'operation'">
3030
<a>action</a>
3131
</template>
32-
<template v-else>{{ text }}</template>
3332
</template>
3433
</a-table>
3534
</template>

0 commit comments

Comments
 (0)