mirror of https://github.com/halo-dev/halo
feat: add generate post default title and slug support
Signed-off-by: Ryan Wang <i@ryanc.cc>pull/3445/head
parent
525b440b8a
commit
1c343f8f3d
|
@ -144,6 +144,14 @@ const handleSave = async () => {
|
||||||
// Set rendered content
|
// Set rendered content
|
||||||
formState.value.content.content = formState.value.content.raw;
|
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) {
|
if (isUpdateMode.value) {
|
||||||
const { data } = await apiClient.post.updateDraftPost(
|
const { data } = await apiClient.post.updateDraftPost(
|
||||||
formState.value.post.metadata.name,
|
formState.value.post.metadata.name,
|
||||||
|
|
Loading…
Reference in New Issue