提交 a23020b7 编写于 作者: L liuyao

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

上级 af6ab989
......@@ -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>
......
......@@ -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');
}
......
......@@ -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: '开始时间',
......
......@@ -53,7 +53,7 @@
actionColumn: {
width: 160,
title: 'Action',
slots: { customRender: 'action' },
// slots: { customRender: 'action' },
},
});
function handleDelete(record: Recordable) {
......
......@@ -74,7 +74,7 @@
width: 160,
title: 'Action',
dataIndex: 'action',
slots: { customRender: 'action' },
// slots: { customRender: 'action' },
},
});
function handleDelete(record: Recordable) {
......
......@@ -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,
},
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册