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" v-model="formState.spec.displayName"
label="名称" label="名称"
type="text" type="text"
name="displayName"
validation="required" validation="required"
></FormKit> ></FormKit>
</FormKit> </FormKit>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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