feat: 更新 README 和 App.vue,添加 FormKit 上下文链接,修改输入框标签及帮助文本
All checks were successful
/ surge (push) Successful in 36s
All checks were successful
/ surge (push) Successful in 36s
This commit is contained in:
@ -9,6 +9,7 @@
|
|||||||
- https://formkit.com/essentials/architecture#getting-a-components-node
|
- https://formkit.com/essentials/architecture#getting-a-components-node
|
||||||
- https://formkit.com/essentials/architecture#getting-a-components-node#message-store
|
- https://formkit.com/essentials/architecture#getting-a-components-node#message-store
|
||||||
- https://formkit.com/essentials/validation#showing-errors
|
- https://formkit.com/essentials/validation#showing-errors
|
||||||
|
- https://formkit.com/inputs/form#useformkitcontext
|
||||||
|
|
||||||
---
|
---
|
||||||
- https://github.com/formkit/formkit/blob/master/packages/addons/src/plugins/autoHeightTextarea.ts
|
- https://github.com/formkit/formkit/blob/master/packages/addons/src/plugins/autoHeightTextarea.ts
|
20
src/App.vue
20
src/App.vue
@ -48,7 +48,7 @@ const SCHEMA: FormKitSchemaDefinition = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
$formkit: 'text',
|
$formkit: 'text',
|
||||||
label: 'JSON Schema’ed Input',
|
label: 'JSON Schema 渲染的输入框',
|
||||||
name: 'input',
|
name: 'input',
|
||||||
validation: 'required',
|
validation: 'required',
|
||||||
validationLabel: 'validationLabel', // validation message 使用顺序:validationLabel > label > name
|
validationLabel: 'validationLabel', // validation message 使用顺序:validationLabel > label > name
|
||||||
@ -57,6 +57,7 @@ const SCHEMA: FormKitSchemaDefinition = [
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -64,12 +65,12 @@ const SCHEMA: FormKitSchemaDefinition = [
|
|||||||
|
|
||||||
<FormKit
|
<FormKit
|
||||||
type="form"
|
type="form"
|
||||||
#default="{ value }"
|
#default="{ value } : { value ?: Record<string, any> }"
|
||||||
@submit="submit"
|
@submit="submit"
|
||||||
submit-label="提交 ✨"
|
submit-label="提交 ✨"
|
||||||
>
|
>
|
||||||
|
<!-- v-auto-animate -->
|
||||||
<div class="character-attributes">
|
<div class="character-attributes">
|
||||||
|
|
||||||
<FormKit
|
<FormKit
|
||||||
type="group"
|
type="group"
|
||||||
name="attributes"
|
name="attributes"
|
||||||
@ -94,10 +95,19 @@ const SCHEMA: FormKitSchemaDefinition = [
|
|||||||
name="name"
|
name="name"
|
||||||
id="nameNodeId"
|
id="nameNodeId"
|
||||||
label="姓名"
|
label="姓名"
|
||||||
help="别人都叫你什么?"
|
:help="`现在 confirmName 的值是:${value?.attributes?.confirmName}`"
|
||||||
some-attr="some-attr-value"
|
some-attr="some-attr-value"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<FormKit
|
||||||
|
v-if="value?.attributes?.name"
|
||||||
|
:preserve="false"
|
||||||
|
name="confirmName"
|
||||||
|
type="checkbox"
|
||||||
|
:value="false"
|
||||||
|
:label="`如果清空 name 输入框,这个确认框及其值将被移除。`"
|
||||||
|
/>
|
||||||
|
|
||||||
<FormKit
|
<FormKit
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="flavors"
|
name="flavors"
|
||||||
@ -109,6 +119,7 @@ const SCHEMA: FormKitSchemaDefinition = [
|
|||||||
}"
|
}"
|
||||||
validation="required|min:2"
|
validation="required|min:2"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormKit
|
<FormKit
|
||||||
type="range"
|
type="range"
|
||||||
name="strength"
|
name="strength"
|
||||||
@ -124,6 +135,7 @@ const SCHEMA: FormKitSchemaDefinition = [
|
|||||||
:plugins="[castNumber]"
|
:plugins="[castNumber]"
|
||||||
class="mb-4"
|
class="mb-4"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormKit
|
<FormKit
|
||||||
type="textarea"
|
type="textarea"
|
||||||
auto-height
|
auto-height
|
||||||
|
@ -7,6 +7,6 @@ import App from './App.vue'
|
|||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
// https://github.dev/formkit/auto-animate/blob/master/docs/src/examples/formkit/ActualFormKit.vue
|
// https://github.dev/formkit/auto-animate/blob/master/docs/src/examples/formkit/ActualFormKit.vue
|
||||||
app.use(autoAnimatePlugin)
|
app.use(autoAnimatePlugin) // v-auto-animate
|
||||||
app.use(plugin, formKitConfig)
|
app.use(plugin, formKitConfig)
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
Reference in New Issue
Block a user