123456789101112131415161718192021222324 |
- import type {
- KeyType,
- TableColumn,
- TableColumnInGroup,
- } from '../components/ColumnSet/index.vue'
- import { Ref } from 'vue'
- export default function useTableColumnSet(
- tableColumns: Ref<TableColumnInGroup[] | TableColumn[]>
- ) {
- const filterColumnKeys = ref<KeyType[]>([])
- const filteredColumns = computed(() =>
- tableColumns.value.filter(({ dataKey }) =>
- filterColumnKeys.value.includes(dataKey)
- )
- )
- const columnChecked = (checkedColumnKeys: string[]) => {
- filterColumnKeys.value = checkedColumnKeys
- }
- return {
- columnChecked,
- filteredColumns,
- }
- }
|