feat: PSelect 暂存
This commit is contained in:
@@ -12,11 +12,9 @@ const input = createSection('input', () => ({
|
||||
props: {
|
||||
invalid: '$state.invalid',
|
||||
disabled: '$disabled',
|
||||
// name: '$node.name',
|
||||
// inputProps: {}
|
||||
modelValue: '$_value',
|
||||
onInput: '$handlers.DOMInput',
|
||||
onBlur: '$handlers.blur',
|
||||
modelValue: '$_value',
|
||||
inputId: '$id',
|
||||
fluid: true,
|
||||
},
|
@@ -14,9 +14,9 @@ const input = createSection('input', () => ({
|
||||
type: '$type',
|
||||
disabled: '$disabled',
|
||||
name: '$node.name',
|
||||
modelValue: '$_value',
|
||||
onInput: '$handlers.DOMInput',
|
||||
onBlur: '$handlers.blur',
|
||||
modelValue: '$_value',
|
||||
id: '$id',
|
||||
fluid: true,
|
||||
},
|
45
src/__fk-inputs__/inputs/p-select.ts
Normal file
45
src/__fk-inputs__/inputs/p-select.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import type { FormKitTypeDefinition } from '@formkit/core';
|
||||
import type { FormKitInputs } from '@formkit/inputs';
|
||||
import { createSection, label, outer } from '@formkit/inputs';
|
||||
import SchemaComponent from 'primevue/select';
|
||||
import { markRaw } from 'vue';
|
||||
import { floatLabel } from '../sections/floatLabel';
|
||||
import { messages } from '../sections/messages';
|
||||
|
||||
const input = createSection('input', () => ({
|
||||
$cmp: markRaw(SchemaComponent) as never,
|
||||
bind: '$attrs',
|
||||
props: {
|
||||
invalid: '$state.invalid',
|
||||
disabled: '$disabled',
|
||||
modelValue: '$_value',
|
||||
// onValueChange: '$handlers.DOMInput',
|
||||
onBlur: '$handlers.blur',
|
||||
id: '$id',
|
||||
fluid: true,
|
||||
options: '$options',
|
||||
},
|
||||
}));
|
||||
|
||||
export const PSelect: FormKitTypeDefinition = {
|
||||
type: 'input',
|
||||
schema: outer(
|
||||
floatLabel(
|
||||
input(), //
|
||||
label('$label'),
|
||||
),
|
||||
messages(),
|
||||
),
|
||||
props: ['options'],
|
||||
// schemaMemoKey: 'nnvujvlf2xr', // Math.random().toString(36).substring(2, 15)
|
||||
};
|
||||
|
||||
declare module '@formkit/inputs' {
|
||||
// https://formkit.com/essentials/custom-inputs#typescript-support
|
||||
interface FormKitInputProps<Props extends FormKitInputs<Props>> {
|
||||
PSelect: {
|
||||
type: 'PSelect';
|
||||
options: Array<any>;
|
||||
};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user