Browse Source

fix: useTablePage 初始化 checkedColumns

lanceJiang 1 year ago
parent
commit
809d3f23b3
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/hooks/useTablePage.ts

+ 2 - 2
src/hooks/useTablePage.ts

@@ -1,4 +1,4 @@
-import { reactive, ref, computed, /*getCurrentInstance,*/ unref, watch, nextTick } from 'vue'
+import {reactive, ref, computed, /*getCurrentInstance,*/ unref, watch, nextTick, shallowRef} from 'vue'
 import { $log } from '@/utils'
 import { $log } from '@/utils'
 // import { ObjectOpts } from '@/components/FormConfig/formConfig.types.ts'
 // import { ObjectOpts } from '@/components/FormConfig/formConfig.types.ts'
 import { LeTableColumnProps, LeTableProps, SearchParams } from '@/components/Table'
 import { LeTableColumnProps, LeTableProps, SearchParams } from '@/components/Table'
@@ -57,7 +57,7 @@ export const useTablePage = (tableProps: Partial<LeTableProps> = {}, config: Par
 	const searchData = ref<SearchData>({
 	const searchData = ref<SearchData>({
 		...config.searchData
 		...config.searchData
 	})
 	})
-	const checkedColumns = ref([])
+	const checkedColumns = shallowRef(tableOpts.columns)
 	const activeColumns = computed(() => {
 	const activeColumns = computed(() => {
 		const _checkedColumns = unref(checkedColumns) as LeTableColumnProps[]
 		const _checkedColumns = unref(checkedColumns) as LeTableColumnProps[]
 		if (!_checkedColumns.length) return tableOpts.columns
 		if (!_checkedColumns.length) return tableOpts.columns