Commit f2d2dc4d9e0b3bcfec490cdbb3d9c5936c8aed26

Authored by xingyu
1 parent df8a0768

perf: XTable hooks

yudao-ui-admin-vue3/src/hooks/web/useXTable.ts
@@ -8,14 +8,14 @@ export interface tableMethod { @@ -8,14 +8,14 @@ export interface tableMethod {
8 exportList: (fileName?: string) => void 8 exportList: (fileName?: string) => void
9 } 9 }
10 10
11 -export function useXTable(props: XTableProps): [Function, tableMethod] { 11 +export const useXTable = (props: XTableProps): [Function, tableMethod] => {
12 const tableRef = ref<Nullable<tableMethod>>(null) 12 const tableRef = ref<Nullable<tableMethod>>(null)
13 13
14 - function register(instance) { 14 + const register = (instance) => {
15 tableRef.value = instance 15 tableRef.value = instance
16 props && instance.setProps(props) 16 props && instance.setProps(props)
17 } 17 }
18 - function getInstance(): tableMethod { 18 + const getInstance = (): tableMethod => {
19 const table = unref(tableRef) 19 const table = unref(tableRef)
20 if (!table) { 20 if (!table) {
21 console.error('表格实例不存在') 21 console.error('表格实例不存在')