提交 a23020b7 作者: liuyao

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

上级 af6ab989
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<slot :name="item" v-bind="data || {}"></slot> <slot :name="item" v-bind="data || {}"></slot>
</template> </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" /> <HeaderCell :column="column" />
</template> </template>
</Table> </Table>
......
...@@ -152,10 +152,10 @@ export function useColumns( ...@@ -152,10 +152,10 @@ export function useColumns(
return hasPermission(column.auth) && isIfShow(column); return hasPermission(column.auth) && isIfShow(column);
}) })
.map((column) => { .map((column) => {
const { slots, dataIndex, customRender, format, edit, editRow, flag } = column; const { slots, customRender, format, edit, editRow, flag } = column;
if (!slots || !slots?.title) { if (!slots || !slots?.title) {
column.slots = { title: `header-${dataIndex}`, ...(slots || {}) }; // column.slots = { title: `header-${dataIndex}`, ...(slots || {}) };
column.customTitle = column.title; column.customTitle = column.title;
Reflect.deleteProperty(column, 'title'); Reflect.deleteProperty(column, 'title');
} }
......
...@@ -32,13 +32,13 @@ ...@@ -32,13 +32,13 @@
{ {
title: 'ID', title: 'ID',
dataIndex: 'id', dataIndex: 'id',
slots: { customRender: 'id' }, // slots: { customRender: 'id' },
}, },
{ {
title: '头像', title: '头像',
dataIndex: 'avatar', dataIndex: 'avatar',
width: 100, width: 100,
slots: { customRender: 'avatar' }, // slots: { customRender: 'avatar' },
}, },
{ {
title: '分类', title: '分类',
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
width: 80, width: 80,
align: 'center', align: 'center',
defaultHidden: true, defaultHidden: true,
slots: { customRender: 'category' }, // slots: { customRender: 'category' },
}, },
{ {
title: '姓名', title: '姓名',
...@@ -58,13 +58,13 @@ ...@@ -58,13 +58,13 @@
dataIndex: 'imgArr', dataIndex: 'imgArr',
helpMessage: ['这是简单模式的图片列表', '只会显示一张在表格中', '但点击可预览多张图片'], helpMessage: ['这是简单模式的图片列表', '只会显示一张在表格中', '但点击可预览多张图片'],
width: 140, width: 140,
slots: { customRender: 'img' }, // slots: { customRender: 'img' },
}, },
{ {
title: '照片列表2', title: '照片列表2',
dataIndex: 'imgs', dataIndex: 'imgs',
width: 160, width: 160,
slots: { customRender: 'imgs' }, // slots: { customRender: 'imgs' },
}, },
{ {
title: '地址', title: '地址',
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
{ {
title: '编号', title: '编号',
dataIndex: 'no', dataIndex: 'no',
slots: { customRender: 'no' }, // slots: { customRender: 'no' },
}, },
{ {
title: '开始时间', title: '开始时间',
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
actionColumn: { actionColumn: {
width: 160, width: 160,
title: 'Action', title: 'Action',
slots: { customRender: 'action' }, // slots: { customRender: 'action' },
}, },
}); });
function handleDelete(record: Recordable) { function handleDelete(record: Recordable) {
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
width: 160, width: 160,
title: 'Action', title: 'Action',
dataIndex: 'action', dataIndex: 'action',
slots: { customRender: 'action' }, // slots: { customRender: 'action' },
}, },
}); });
function handleDelete(record: Recordable) { function handleDelete(record: Recordable) {
......
...@@ -123,13 +123,13 @@ export function getCustomHeaderColumns(): BasicColumn[] { ...@@ -123,13 +123,13 @@ export function getCustomHeaderColumns(): BasicColumn[] {
// title: '姓名', // title: '姓名',
dataIndex: 'name', dataIndex: 'name',
width: 120, width: 120,
slots: { title: 'customTitle' }, // slots: { title: 'customTitle' },
}, },
{ {
// title: '地址', // title: '地址',
dataIndex: 'address', dataIndex: 'address',
width: 120, width: 120,
slots: { title: 'customAddress' }, // slots: { title: 'customAddress' },
sorter: true, sorter: true,
}, },
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论