diff --git a/src/__fk-inputs__/inputs/p-input-text.ts b/src/__fk-inputs__/inputs/p-input-text.ts index 7b9e696..01c23e3 100644 --- a/src/__fk-inputs__/inputs/p-input-text.ts +++ b/src/__fk-inputs__/inputs/p-input-text.ts @@ -5,6 +5,7 @@ import SchemaComponent from 'primevue/inputtext'; import { markRaw } from 'vue'; import { floatLabel } from '../sections/floatLabel'; import { messages } from '../sections/messages'; +import { help } from '../sections/help'; const input = createSection('input', () => ({ $cmp: markRaw(SchemaComponent) as never, @@ -29,6 +30,7 @@ export const PInputText: FormKitTypeDefinition = { input(), // label('$label'), ), + help('$help'), messages(), ), features: [casts], diff --git a/src/__fk-inputs__/sections/help.ts b/src/__fk-inputs__/sections/help.ts new file mode 100644 index 0000000..e8c72da --- /dev/null +++ b/src/__fk-inputs__/sections/help.ts @@ -0,0 +1,14 @@ +import { createSection } from '@formkit/inputs'; + +/** + * Help section that shows help text + * + * @public + */ +export const help = createSection('help', () => ({ + $el: 'div', + if: '$help', + attrs: { + id: '$: "help-" + $id', + }, +})); diff --git a/src/__fk-inputs__/sections/messages.ts b/src/__fk-inputs__/sections/messages.ts index 4171364..4af284a 100644 --- a/src/__fk-inputs__/sections/messages.ts +++ b/src/__fk-inputs__/sections/messages.ts @@ -1,4 +1,4 @@ -import MessagesCmp from '@/__fk-inputs__/components/messages.vue'; +import MessagesCmp from '../components/messages.vue'; import { createSection } from '@formkit/inputs'; import { markRaw } from 'vue'; diff --git a/src/all-custom/all-custom.vue b/src/all-custom/all-custom.vue index 0a4b5e6..ca835da 100644 --- a/src/all-custom/all-custom.vue +++ b/src/all-custom/all-custom.vue @@ -106,6 +106,7 @@ const promiseCascadeOptions = new Promise((resolve) => { name="PInputText" label="输入框" value="`default value from field`" + help="帮助信息帮助信息帮助信息帮助信息" some="prop" some-boolean-prop validation="required" @@ -167,6 +168,7 @@ const promiseCascadeOptions = new Promise((resolve) => { :preserve="false" name="customType" value="this input will display if the password is empty" + help="helppppppppppp" >