Commit 4cda7c6fc13f5636224f0ca4fdaa83fc1613061c

Authored by jinmao88
Committed by GitHub
2 parents af6ab989 a23020b7

Merge pull request #1705 from shellingfordly/main

fix(table): 修复antd报错,column.slots已废弃,修改为v-slot:headerCell

Too many changes to show.

To preserve performance only 6 of 7 files are displayed.

src/components/Table/src/BasicTable.vue
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 <slot :name="item" v-bind="data || {}"></slot> 26 <slot :name="item" v-bind="data || {}"></slot>
27 </template> 27 </template>
28 28
29 - <template #[`header-${column.dataIndex}`] v-for="(column, index) in columns" :key="index"> 29 + <template #headerCell v-for="(column, index) in columns" :key="index">
30 <HeaderCell :column="column" /> 30 <HeaderCell :column="column" />
31 </template> 31 </template>
32 </Table> 32 </Table>
src/components/Table/src/hooks/useColumns.ts
@@ -152,10 +152,10 @@ export function useColumns( @@ -152,10 +152,10 @@ export function useColumns(
152 return hasPermission(column.auth) && isIfShow(column); 152 return hasPermission(column.auth) && isIfShow(column);
153 }) 153 })
154 .map((column) => { 154 .map((column) => {
155 - const { slots, dataIndex, customRender, format, edit, editRow, flag } = column; 155 + const { slots, customRender, format, edit, editRow, flag } = column;
156 156
157 if (!slots || !slots?.title) { 157 if (!slots || !slots?.title) {
158 - column.slots = { title: `header-${dataIndex}`, ...(slots || {}) }; 158 + // column.slots = { title: `header-${dataIndex}`, ...(slots || {}) };
159 column.customTitle = column.title; 159 column.customTitle = column.title;
160 Reflect.deleteProperty(column, 'title'); 160 Reflect.deleteProperty(column, 'title');
161 } 161 }
src/views/demo/table/CustomerCell.vue
@@ -32,13 +32,13 @@ @@ -32,13 +32,13 @@
32 { 32 {
33 title: 'ID', 33 title: 'ID',
34 dataIndex: 'id', 34 dataIndex: 'id',
35 - slots: { customRender: 'id' }, 35 + // slots: { customRender: 'id' },
36 }, 36 },
37 { 37 {
38 title: '头像', 38 title: '头像',
39 dataIndex: 'avatar', 39 dataIndex: 'avatar',
40 width: 100, 40 width: 100,
41 - slots: { customRender: 'avatar' }, 41 + // slots: { customRender: 'avatar' },
42 }, 42 },
43 { 43 {
44 title: '分类', 44 title: '分类',
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 width: 80, 46 width: 80,
47 align: 'center', 47 align: 'center',
48 defaultHidden: true, 48 defaultHidden: true,
49 - slots: { customRender: 'category' }, 49 + // slots: { customRender: 'category' },
50 }, 50 },
51 { 51 {
52 title: '姓名', 52 title: '姓名',
@@ -58,13 +58,13 @@ @@ -58,13 +58,13 @@
58 dataIndex: 'imgArr', 58 dataIndex: 'imgArr',
59 helpMessage: ['这是简单模式的图片列表', '只会显示一张在表格中', '但点击可预览多张图片'], 59 helpMessage: ['这是简单模式的图片列表', '只会显示一张在表格中', '但点击可预览多张图片'],
60 width: 140, 60 width: 140,
61 - slots: { customRender: 'img' }, 61 + // slots: { customRender: 'img' },
62 }, 62 },
63 { 63 {
64 title: '照片列表2', 64 title: '照片列表2',
65 dataIndex: 'imgs', 65 dataIndex: 'imgs',
66 width: 160, 66 width: 160,
67 - slots: { customRender: 'imgs' }, 67 + // slots: { customRender: 'imgs' },
68 }, 68 },
69 { 69 {
70 title: '地址', 70 title: '地址',
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 { 73 {
74 title: '编号', 74 title: '编号',
75 dataIndex: 'no', 75 dataIndex: 'no',
76 - slots: { customRender: 'no' }, 76 + // slots: { customRender: 'no' },
77 }, 77 },
78 { 78 {
79 title: '开始时间', 79 title: '开始时间',
src/views/demo/table/ExpandTable.vue
@@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
53 actionColumn: { 53 actionColumn: {
54 width: 160, 54 width: 160,
55 title: 'Action', 55 title: 'Action',
56 - slots: { customRender: 'action' }, 56 + // slots: { customRender: 'action' },
57 }, 57 },
58 }); 58 });
59 function handleDelete(record: Recordable) { 59 function handleDelete(record: Recordable) {
src/views/demo/table/FixedColumn.vue
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 width: 160, 74 width: 160,
75 title: 'Action', 75 title: 'Action',
76 dataIndex: 'action', 76 dataIndex: 'action',
77 - slots: { customRender: 'action' }, 77 + // slots: { customRender: 'action' },
78 }, 78 },
79 }); 79 });
80 function handleDelete(record: Recordable) { 80 function handleDelete(record: Recordable) {
src/views/demo/table/tableData.tsx
@@ -123,13 +123,13 @@ export function getCustomHeaderColumns(): BasicColumn[] { @@ -123,13 +123,13 @@ export function getCustomHeaderColumns(): BasicColumn[] {
123 // title: '姓名', 123 // title: '姓名',
124 dataIndex: 'name', 124 dataIndex: 'name',
125 width: 120, 125 width: 120,
126 - slots: { title: 'customTitle' }, 126 + // slots: { title: 'customTitle' },
127 }, 127 },
128 { 128 {
129 // title: '地址', 129 // title: '地址',
130 dataIndex: 'address', 130 dataIndex: 'address',
131 width: 120, 131 width: 120,
132 - slots: { title: 'customAddress' }, 132 + // slots: { title: 'customAddress' },
133 sorter: true, 133 sorter: true,
134 }, 134 },
135 135