From f76f2072c8fe7c658053911ecef0e5bdf86740d9 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Mon, 26 Sep 2022 16:20:17 +0800 Subject: [PATCH] feat: add name attribute for formkit component Signed-off-by: Ryan Wang --- .../components/AttachmentGroupEditingModal.vue | 1 + .../components/AttachmentPolicyEditingModal.vue | 1 + src/modules/contents/pages/SinglePageEditor.vue | 2 +- .../pages/components/SinglePageSettingModal.vue | 9 ++++++++- src/modules/contents/posts/PostEditor.vue | 2 +- .../categories/components/CategoryEditingModal.vue | 11 +++++++---- .../contents/posts/components/PostSettingModal.vue | 7 ++++++- .../posts/tags/components/TagEditingModal.vue | 4 ++++ .../interface/menus/components/MenuEditingModal.vue | 1 + .../menus/components/MenuItemEditingModal.vue | 2 ++ .../system/roles/components/RoleEditingModal.vue | 1 + .../system/users/components/UserEditingModal.vue | 6 ++++++ 12 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/modules/contents/attachments/components/AttachmentGroupEditingModal.vue b/src/modules/contents/attachments/components/AttachmentGroupEditingModal.vue index 131ea6f7..e43c3511 100644 --- a/src/modules/contents/attachments/components/AttachmentGroupEditingModal.vue +++ b/src/modules/contents/attachments/components/AttachmentGroupEditingModal.vue @@ -127,6 +127,7 @@ watch( v-model="formState.spec.displayName" label="名称" type="text" + name="displayName" validation="required" > diff --git a/src/modules/contents/attachments/components/AttachmentPolicyEditingModal.vue b/src/modules/contents/attachments/components/AttachmentPolicyEditingModal.vue index 2991bfc2..408bd817 100644 --- a/src/modules/contents/attachments/components/AttachmentPolicyEditingModal.vue +++ b/src/modules/contents/attachments/components/AttachmentPolicyEditingModal.vue @@ -205,6 +205,7 @@ const onVisibleChange = (visible: boolean) => { v-model="formState.spec.displayName" label="名称" type="text" + name="displayName" validation="required" > diff --git a/src/modules/contents/pages/SinglePageEditor.vue b/src/modules/contents/pages/SinglePageEditor.vue index 7ddd0fc9..c735a24c 100644 --- a/src/modules/contents/pages/SinglePageEditor.vue +++ b/src/modules/contents/pages/SinglePageEditor.vue @@ -32,7 +32,7 @@ const initialFormState: SinglePageRequest = { cover: "", deleted: false, published: false, - publishTime: undefined, + publishTime: "", pinned: false, allowComment: true, visible: "PUBLIC", diff --git a/src/modules/contents/pages/components/SinglePageSettingModal.vue b/src/modules/contents/pages/components/SinglePageSettingModal.vue index 89c292fb..77181806 100644 --- a/src/modules/contents/pages/components/SinglePageSettingModal.vue +++ b/src/modules/contents/pages/components/SinglePageSettingModal.vue @@ -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" > { { label: '是', value: true }, { label: '否', value: false }, ]" + name="autoGenerate" label="自动生成摘要" type="radio" > @@ -208,6 +210,7 @@ watchEffect(() => { @@ -227,6 +230,7 @@ watchEffect(() => { { label: '是', value: true }, { label: '否', value: false }, ]" + name="allowComment" label="禁止评论" type="radio" > @@ -255,16 +259,19 @@ watchEffect(() => { v-model="formState.page.spec.publishTime" label="发表时间" type="datetime-local" + name="publishTime" > diff --git a/src/modules/contents/posts/PostEditor.vue b/src/modules/contents/posts/PostEditor.vue index 1ac1250a..5c087132 100644 --- a/src/modules/contents/posts/PostEditor.vue +++ b/src/modules/contents/posts/PostEditor.vue @@ -47,7 +47,7 @@ const initialFormState: PostRequest = { cover: "", deleted: false, published: false, - publishTime: undefined, + publishTime: "", pinned: false, allowComment: true, visible: "PUBLIC", diff --git a/src/modules/contents/posts/categories/components/CategoryEditingModal.vue b/src/modules/contents/posts/categories/components/CategoryEditingModal.vue index 4de2453f..8f7e08ae 100644 --- a/src/modules/contents/posts/categories/components/CategoryEditingModal.vue +++ b/src/modules/contents/posts/categories/components/CategoryEditingModal.vue @@ -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( - { v-model="formState.post.spec.title" label="标题" type="text" + name="title" validation="required" > { { 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" > @@ -307,10 +310,12 @@ watchEffect(() => { diff --git a/src/modules/contents/posts/tags/components/TagEditingModal.vue b/src/modules/contents/posts/tags/components/TagEditingModal.vue index d5a6b0cd..8c83f116 100644 --- a/src/modules/contents/posts/tags/components/TagEditingModal.vue +++ b/src/modules/contents/posts/tags/components/TagEditingModal.vue @@ -146,6 +146,7 @@ watch( diff --git a/src/modules/interface/menus/components/MenuItemEditingModal.vue b/src/modules/interface/menus/components/MenuItemEditingModal.vue index 7b660d76..073c4d6c 100644 --- a/src/modules/interface/menus/components/MenuItemEditingModal.vue +++ b/src/modules/interface/menus/components/MenuItemEditingModal.vue @@ -319,6 +319,7 @@ watch( v-model="formState.spec.displayName" label="名称" type="text" + name="displayName" validation="required" > diff --git a/src/modules/system/roles/components/RoleEditingModal.vue b/src/modules/system/roles/components/RoleEditingModal.vue index 3af14949..3ffb6216 100644 --- a/src/modules/system/roles/components/RoleEditingModal.vue +++ b/src/modules/system/roles/components/RoleEditingModal.vue @@ -137,6 +137,7 @@ const handleResetForm = () => { help="角色别名,用于区分角色,不能重复,创建之后不能修改" label="别名" type="text" + name="name" :disabled="isUpdateMode" validation="required" > diff --git a/src/modules/system/users/components/UserEditingModal.vue b/src/modules/system/users/components/UserEditingModal.vue index bc20a4e5..3d3645f0 100644 --- a/src/modules/system/users/components/UserEditingModal.vue +++ b/src/modules/system/users/components/UserEditingModal.vue @@ -201,6 +201,7 @@ const handleRawModeChange = () => { :disabled="isUpdateMode" label="用户名" type="text" + name="name" validation="required" > { v-model="formState.spec.displayName" label="显示名称" type="text" + name="displayName" validation="required" > { v-model="formState.spec.phone" label="手机号" type="text" + name="phone" >