feat: 更新 PSelect 组件,优化类型定义
This commit is contained in:
@ -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>;
|
||||
|
||||
|
Reference in New Issue
Block a user