|
@@ -8,13 +8,7 @@ import type { Component } from 'vue';
|
|
|
import type { BaseFormComponentType } from '@vben/common-ui';
|
|
|
import type { Recordable } from '@vben/types';
|
|
|
|
|
|
-import {
|
|
|
- defineAsyncComponent,
|
|
|
- defineComponent,
|
|
|
- getCurrentInstance,
|
|
|
- h,
|
|
|
- ref,
|
|
|
-} from 'vue';
|
|
|
+import { defineAsyncComponent, defineComponent, h, ref } from 'vue';
|
|
|
|
|
|
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
|
|
|
import { $t } from '@vben/locales';
|
|
@@ -82,16 +76,24 @@ const withDefaultPlaceholder = <T extends Component>(
|
|
|
$t(`ui.placeholder.${type}`);
|
|
|
// 透传组件暴露的方法
|
|
|
const innerRef = ref();
|
|
|
- const publicApi: Recordable<any> = {};
|
|
|
- expose(publicApi);
|
|
|
- const instance = getCurrentInstance();
|
|
|
- instance?.proxy?.$nextTick(() => {
|
|
|
- for (const key in innerRef.value) {
|
|
|
- if (typeof innerRef.value[key] === 'function') {
|
|
|
- publicApi[key] = innerRef.value[key];
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ // const publicApi: Recordable<any> = {};
|
|
|
+ expose(
|
|
|
+ new Proxy(
|
|
|
+ {},
|
|
|
+ {
|
|
|
+ get: (_target, key) => innerRef.value?.[key],
|
|
|
+ has: (_target, key) => key in (innerRef.value || {}),
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ // const instance = getCurrentInstance();
|
|
|
+ // instance?.proxy?.$nextTick(() => {
|
|
|
+ // for (const key in innerRef.value) {
|
|
|
+ // if (typeof innerRef.value[key] === 'function') {
|
|
|
+ // publicApi[key] = innerRef.value[key];
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
return () =>
|
|
|
h(
|
|
|
component,
|