diff --git a/packages/crud/package.json b/packages/crud/package.json index 508583a..45cb38b 100644 --- a/packages/crud/package.json +++ b/packages/crud/package.json @@ -1,6 +1,6 @@ { "name": "@cool-vue/crud", - "version": "7.2.12", + "version": "7.2.13", "private": false, "main": "./dist/index.umd.min.js", "typings": "types/index.d.ts", diff --git a/packages/crud/src/hooks/index.ts b/packages/crud/src/hooks/index.ts index 46e88ac..709ee98 100644 --- a/packages/crud/src/hooks/index.ts +++ b/packages/crud/src/hooks/index.ts @@ -60,10 +60,15 @@ export function useProxy(ctx: any) { } export function useElApi(keys: string[], el: any) { - return keys.reduce((apis, key) => { - apis[key] = computed(() => el.value?.[key]); - return apis; - }, {} as obj); + const apis: obj = {}; + + keys.forEach((e) => { + apis[e] = (...args: any[]) => { + return el.value[e](...args); + }; + }); + + return apis; } export * from "./crud";