fix: update bodyCell headerCell
parent
562d86f189
commit
c45b93bc8e
|
@ -623,7 +623,6 @@ const Table = defineComponent<TableProps>({
|
|||
setup(_props, { attrs, slots }) {
|
||||
return () => {
|
||||
const columns = (attrs.columns || convertChildrenToColumns(slots.default?.())) as ColumnsType;
|
||||
console.log('slots', slots);
|
||||
return (
|
||||
<InteralTable
|
||||
{...attrs}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import devWarning from '../../vc-util/devWarning';
|
||||
import type { Ref } from 'vue';
|
||||
import { ContextSlots } from '../context';
|
||||
import type { TransformColumns, ColumnTitleProps, ColumnsType } from '../interface';
|
||||
|
@ -13,6 +14,12 @@ function fillTitle<RecordType>(
|
|||
const cloneColumn = { ...column };
|
||||
const { slots = {} } = cloneColumn;
|
||||
|
||||
devWarning(
|
||||
!('slots' in cloneColumn),
|
||||
'Table',
|
||||
'`column.slots` is deprecated. Please use `v-slot:headerCell` `v-slot:bodyCell` instead.',
|
||||
);
|
||||
|
||||
Object.keys(slots).forEach(key => {
|
||||
const name = slots[key];
|
||||
if (cloneColumn[key] === undefined && $slots[name]) {
|
||||
|
|
|
@ -119,7 +119,7 @@ export default defineComponent<CellProps>({
|
|||
const children = slots.default?.();
|
||||
if (validateValue(children) || cellType === 'header') {
|
||||
childNode = children;
|
||||
if (cellType === 'header' && contextSlots.value.headerCell) {
|
||||
if (cellType === 'header' && contextSlots.value.headerCell && !column.slots?.title) {
|
||||
childNode = contextSlots.value.headerCell({ title: column.title, index, column });
|
||||
}
|
||||
} else {
|
||||
|
@ -138,7 +138,7 @@ export default defineComponent<CellProps>({
|
|||
}
|
||||
}
|
||||
|
||||
if (cellType === 'body' && contextSlots.value.bodyCell) {
|
||||
if (cellType === 'body' && contextSlots.value.bodyCell && !column.slots?.customRender) {
|
||||
childNode = contextSlots.value.bodyCell({ text: value, value, record, index, column });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue