fix(table): type 为selection只能是table下的children,不能是children的children

This commit is contained in:
roymondchen 2022-10-14 15:48:01 +08:00 committed by jia000
parent 6caa8cdb79
commit a6ecbb66d1

View File

@ -24,12 +24,13 @@
</template>
<template v-else-if="item.selection">
<TMagicTableColumn
type="selection"
:key="columnIndex"
<component
width="40"
type="selection"
:is="tableColumnComponent.component"
:key="columnIndex"
:selectable="item.selectable"
></TMagicTableColumn>
></component>
</template>
<template v-else-if="item.actions">
@ -58,7 +59,7 @@
import { computed, ref } from 'vue';
import { cloneDeep } from 'lodash-es';
import { TMagicTable, TMagicTableColumn } from '@tmagic/design';
import { getConfig, TMagicTable } from '@tmagic/design';
import ActionsColumn from './ActionsColumn.vue';
import ExpandColumn from './ExpandColumn.vue';
@ -99,6 +100,7 @@ const tMagicTable = ref<InstanceType<typeof TMagicTable>>();
const editState = ref([]);
const tableColumnComponent = getConfig('components').tableColumn;
const selectionColumn = computed(() => {
const column = props.columns.filter((item) => item.selection);
return column.length ? column[0] : null;