From 7a1712807fd1d5e31d99795dbfd8813282d66331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Mon, 30 Dec 2024 14:08:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=20PInputText=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=B7=BB=E5=8A=A0=E5=B8=AE=E5=8A=A9=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/__fk-inputs__/inputs/p-input-text.ts | 2 ++ src/__fk-inputs__/sections/help.ts | 14 ++++++++++++++ src/__fk-inputs__/sections/messages.ts | 2 +- src/all-custom/all-custom.vue | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/__fk-inputs__/sections/help.ts 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" >