feat: add generate post default title and slug support

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/603/head
Ryan Wang 2022-08-24 15:41:29 +08:00
parent e3fc574b30
commit 417843807f
1 changed files with 8 additions and 0 deletions

View File

@ -144,6 +144,14 @@ const handleSave = async () => {
// Set rendered content
formState.value.content.content = formState.value.content.raw;
// Set default title and slug
if (!formState.value.post.spec.title) {
formState.value.post.spec.title = "无标题文章";
}
if (!formState.value.post.spec.slug) {
formState.value.post.spec.slug = uuid();
}
if (isUpdateMode.value) {
const { data } = await apiClient.post.updateDraftPost(
formState.value.post.metadata.name,