feat: 更新 PSelect 组件,优化类型定义
All checks were successful
/ test (push) Successful in 26s
/ surge (push) Successful in 33s

This commit is contained in:
严浩
2024-12-06 16:29:27 +08:00
parent 9b78830313
commit c3bdd9ba9a

View File

@ -18,9 +18,9 @@ type PrimevueSelectListeners = {
const PSelectComp = defineComponent(
(vueProps: { context: FormKitFrameworkContext }) => {
const formkitContext = vueProps.context;
const primevueSelectInstance = ref<Record<string, any> | undefined>();
const primevueSelectInstance = ref<Record<string, unknown> | undefined>();
const listeners: PrimevueSelectListeners = {
'onUpdate:modelValue': (value: any) => {
'onUpdate:modelValue': (value: unknown) => {
formkitContext.node.input(value);
},
'onBlur': async e => {
@ -41,7 +41,7 @@ const PSelectComp = defineComponent(
if (formkitContext.options instanceof Promise) {
result = await formkitContext.options;
} else if (typeof formkitContext.options === 'function') {
const funcResult = await (formkitContext.options as Function).call(undefined);
const funcResult = await (formkitContext.options as () => unknown).call(undefined);
result = funcResult instanceof Promise ? await funcResult : funcResult;
} else {
result = formkitContext.options;
@ -118,6 +118,7 @@ export const PSelect: FormKitTypeDefinition = {
// schemaMemoKey: 'nnvujvlf2xr', // Math.random().toString(36).substring(2, 15)
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type OptionsItem = Record<string, any>;
type OptionsType = Array<OptionsItem>;