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