feat: add name attribute for formkit component

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/621/head^2
Ryan Wang 2022-09-26 16:20:17 +08:00
parent 2c7d8551fb
commit f76f2072c8
12 changed files with 39 additions and 8 deletions

View File

@ -127,6 +127,7 @@ watch(
v-model="formState.spec.displayName"
label="名称"
type="text"
name="displayName"
validation="required"
></FormKit>
</FormKit>

View File

@ -205,6 +205,7 @@ const onVisibleChange = (visible: boolean) => {
v-model="formState.spec.displayName"
label="名称"
type="text"
name="displayName"
validation="required"
></FormKit>
<FormKitSchema :schema="formSchema" />

View File

@ -32,7 +32,7 @@ const initialFormState: SinglePageRequest = {
cover: "",
deleted: false,
published: false,
publishTime: undefined,
publishTime: "",
pinned: false,
allowComment: true,
visible: "PUBLIC",

View File

@ -15,7 +15,7 @@ const initialFormState: SinglePageRequest = {
cover: "",
deleted: false,
published: false,
publishTime: undefined,
publishTime: "",
pinned: false,
allowComment: true,
visible: "PUBLIC",
@ -186,6 +186,7 @@ watchEffect(() => {
v-model="formState.page.spec.title"
label="标题"
type="text"
name="title"
validation="required"
></FormKit>
<FormKit
@ -201,6 +202,7 @@ watchEffect(() => {
{ label: '是', value: true },
{ label: '否', value: false },
]"
name="autoGenerate"
label="自动生成摘要"
type="radio"
>
@ -208,6 +210,7 @@ watchEffect(() => {
<FormKit
v-if="!formState.page.spec.excerpt.autoGenerate"
v-model="formState.page.spec.excerpt.raw"
name="raw"
label="自定义摘要"
type="textarea"
></FormKit>
@ -227,6 +230,7 @@ watchEffect(() => {
{ label: '是', value: true },
{ label: '否', value: false },
]"
name="allowComment"
label="禁止评论"
type="radio"
></FormKit>
@ -255,16 +259,19 @@ watchEffect(() => {
v-model="formState.page.spec.publishTime"
label="发表时间"
type="datetime-local"
name="publishTime"
></FormKit>
<FormKit
v-model="formState.page.spec.template"
label="自定义模板"
type="text"
name="template"
></FormKit>
<FormKit
v-model="formState.page.spec.cover"
label="封面图"
type="text"
name="cover"
></FormKit>
</FormKit>
</VTabItem>

View File

@ -47,7 +47,7 @@ const initialFormState: PostRequest = {
cover: "",
deleted: false,
published: false,
publishTime: undefined,
publishTime: "",
pinned: false,
allowComment: true,
visible: "PUBLIC",

View File

@ -36,9 +36,9 @@ const initialFormState: Category = {
spec: {
displayName: "",
slug: "",
description: undefined,
cover: undefined,
template: undefined,
description: "",
cover: "",
template: "",
priority: 0,
children: [],
},
@ -134,6 +134,7 @@ watch(
<FormKit
id="displayNameInput"
v-model="formState.spec.displayName"
name="displayName"
label="名称"
type="text"
validation="required"
@ -141,19 +142,21 @@ watch(
<FormKit
v-model="formState.spec.slug"
help="通常作为分类访问地址标识"
name="slug"
label="别名"
type="text"
validation="required"
></FormKit>
<FormKit label="上级目录" type="select"></FormKit>
<FormKit
v-model="formState.spec.cover"
help="需要主题适配以支持"
name="cover"
label="封面图"
type="text"
></FormKit>
<FormKit
v-model="formState.spec.description"
name="description"
help="需要主题适配以支持"
label="描述"
type="textarea"

View File

@ -17,7 +17,7 @@ const initialFormState: PostRequest = {
cover: "",
deleted: false,
published: false,
publishTime: undefined,
publishTime: "",
pinned: false,
allowComment: true,
visible: "PUBLIC",
@ -220,6 +220,7 @@ watchEffect(() => {
v-model="formState.post.spec.title"
label="标题"
type="text"
name="title"
validation="required"
></FormKit>
<FormKit
@ -249,6 +250,7 @@ watchEffect(() => {
{ label: '是', value: true },
{ label: '否', value: false },
]"
name="autoGenerate"
label="自动生成摘要"
type="radio"
>
@ -257,6 +259,7 @@ watchEffect(() => {
v-if="!formState.post.spec.excerpt.autoGenerate"
v-model="formState.post.spec.excerpt.raw"
label="自定义摘要"
name="raw"
type="textarea"
></FormKit>
</FormKit>
@ -307,10 +310,12 @@ watchEffect(() => {
<FormKit
v-model="formState.post.spec.template"
label="自定义模板"
name="template"
type="text"
></FormKit>
<FormKit
v-model="formState.post.spec.cover"
name="cover"
label="封面图"
type="text"
></FormKit>

View File

@ -146,6 +146,7 @@ watch(
<FormKit
id="displayNameInput"
v-model="formState.spec.displayName"
name="displayName"
label="名称"
type="text"
validation="required"
@ -154,17 +155,20 @@ watch(
v-model="formState.spec.slug"
help="通常作为标签访问地址标识"
label="别名"
name="slug"
type="text"
validation="required"
></FormKit>
<FormKit
v-model="formState.spec.color"
name="color"
help="需要主题适配以支持"
label="颜色"
type="color"
></FormKit>
<FormKit
v-model="formState.spec.cover"
name="cover"
help="需要主题适配以支持"
label="封面图"
type="text"

View File

@ -122,6 +122,7 @@ watch(
help="可根据此名称查询菜单项"
label="菜单名称"
type="text"
name="displayName"
validation="required"
></FormKit>
</FormKit>

View File

@ -319,6 +319,7 @@ watch(
v-model="formState.spec.displayName"
label="名称"
type="text"
name="displayName"
validation="required"
></FormKit>
<FormKit
@ -326,6 +327,7 @@ watch(
v-model="formState.spec.href"
label="链接地址"
type="text"
name="href"
validation="required"
></FormKit>

View File

@ -137,6 +137,7 @@ const handleResetForm = () => {
help="角色别名,用于区分角色,不能重复,创建之后不能修改"
label="别名"
type="text"
name="name"
:disabled="isUpdateMode"
validation="required"
></FormKit>

View File

@ -201,6 +201,7 @@ const handleRawModeChange = () => {
:disabled="isUpdateMode"
label="用户名"
type="text"
name="name"
validation="required"
></FormKit>
<FormKit
@ -208,12 +209,14 @@ const handleRawModeChange = () => {
v-model="formState.spec.displayName"
label="显示名称"
type="text"
name="displayName"
validation="required"
></FormKit>
<FormKit
v-model="formState.spec.email"
label="电子邮箱"
type="email"
name="email"
validation="required"
></FormKit>
<FormKit
@ -226,16 +229,19 @@ const handleRawModeChange = () => {
v-model="formState.spec.phone"
label="手机号"
type="text"
name="phone"
></FormKit>
<FormKit
v-model="formState.spec.avatar"
label="头像"
type="text"
name="avatar"
></FormKit>
<FormKit
v-model="formState.spec.bio"
label="描述"
type="textarea"
name="bio"
></FormKit>
</FormKit>
</div>