Merge pull request #1705 from shellingfordly/main

fix(table): 修复antd报错,column.slots已废弃,修改为v-slot:headerCell
This commit is contained in:
jinmao88 2022-03-14 11:38:58 +08:00 committed by GitHub
commit 4cda7c6fc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11643 additions and 13 deletions

View File

@ -26,7 +26,7 @@
<slot :name="item" v-bind="data || {}"></slot>
</template>
<template #[`header-${column.dataIndex}`] v-for="(column, index) in columns" :key="index">
<template #headerCell v-for="(column, index) in columns" :key="index">
<HeaderCell :column="column" />
</template>
</Table>

View File

@ -152,10 +152,10 @@ export function useColumns(
return hasPermission(column.auth) && isIfShow(column);
})
.map((column) => {
const { slots, dataIndex, customRender, format, edit, editRow, flag } = column;
const { slots, customRender, format, edit, editRow, flag } = column;
if (!slots || !slots?.title) {
column.slots = { title: `header-${dataIndex}`, ...(slots || {}) };
// column.slots = { title: `header-${dataIndex}`, ...(slots || {}) };
column.customTitle = column.title;
Reflect.deleteProperty(column, 'title');
}

View File

@ -32,13 +32,13 @@
{
title: 'ID',
dataIndex: 'id',
slots: { customRender: 'id' },
// slots: { customRender: 'id' },
},
{
title: '头像',
dataIndex: 'avatar',
width: 100,
slots: { customRender: 'avatar' },
// slots: { customRender: 'avatar' },
},
{
title: '分类',
@ -46,7 +46,7 @@
width: 80,
align: 'center',
defaultHidden: true,
slots: { customRender: 'category' },
// slots: { customRender: 'category' },
},
{
title: '姓名',
@ -58,13 +58,13 @@
dataIndex: 'imgArr',
helpMessage: ['这是简单模式的图片列表', '只会显示一张在表格中', '但点击可预览多张图片'],
width: 140,
slots: { customRender: 'img' },
// slots: { customRender: 'img' },
},
{
title: '照片列表2',
dataIndex: 'imgs',
width: 160,
slots: { customRender: 'imgs' },
// slots: { customRender: 'imgs' },
},
{
title: '地址',
@ -73,7 +73,7 @@
{
title: '编号',
dataIndex: 'no',
slots: { customRender: 'no' },
// slots: { customRender: 'no' },
},
{
title: '开始时间',

View File

@ -53,7 +53,7 @@
actionColumn: {
width: 160,
title: 'Action',
slots: { customRender: 'action' },
// slots: { customRender: 'action' },
},
});
function handleDelete(record: Recordable) {

View File

@ -74,7 +74,7 @@
width: 160,
title: 'Action',
dataIndex: 'action',
slots: { customRender: 'action' },
// slots: { customRender: 'action' },
},
});
function handleDelete(record: Recordable) {

View File

@ -123,13 +123,13 @@ export function getCustomHeaderColumns(): BasicColumn[] {
// title: '姓名',
dataIndex: 'name',
width: 120,
slots: { title: 'customTitle' },
// slots: { title: 'customTitle' },
},
{
// title: '地址',
dataIndex: 'address',
width: 120,
slots: { title: 'customAddress' },
// slots: { title: 'customAddress' },
sorter: true,
},

11630
yarn.lock Normal file

File diff suppressed because it is too large Load Diff