feat: Support dynamic column titles in table column settings

在 columns 重 title 属性可以传入渲染函数
This commit is contained in:
PED 2025-02-27 17:34:29 +08:00 committed by GitHub
parent a03becdaed
commit e97b905ae5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,7 +25,12 @@ const columns = defineModel<NaiveUI.TableColumnCheck[]>('columns', {
<div v-for="item in columns" :key="item.key" class="h-36px flex-y-center rd-4px hover:(bg-primary bg-opacity-20)"> <div v-for="item in columns" :key="item.key" class="h-36px flex-y-center rd-4px hover:(bg-primary bg-opacity-20)">
<icon-mdi-drag class="mr-8px h-full cursor-move text-icon" /> <icon-mdi-drag class="mr-8px h-full cursor-move text-icon" />
<NCheckbox v-model:checked="item.checked" class="none_draggable flex-1"> <NCheckbox v-model:checked="item.checked" class="none_draggable flex-1">
{{ item.title }} <template v-if="typeof item.title === 'function'">
<component :is="item.title" />
</template>
<template v-else>
{{ item.title }}
</template>
</NCheckbox> </NCheckbox>
</div> </div>
</VueDraggable> </VueDraggable>