fix: the issue that the useSlugify hook may cause the value to be undefined (halo-dev/console#884)

#### What type of PR is this?

/kind bug

#### What this PR does / why we need it:

修复新建分类和标签之后再次打开表单,别名显示为 undefined 的问题。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/3382

#### Special notes for your reviewer:

测试方式:

1. 新建分类或者标签,创建完成之后再次打开创建表单,检查别名是否还为 undefined。

#### Does this PR introduce a user-facing change?

```release-note
修复 Console 端新建分类和标签之后再次打开表单,别名显示为 undefined 的问题。
```
pull/3445/head
Ryan Wang 2023-02-24 15:10:12 +08:00 committed by GitHub
parent 11d9cf669d
commit 9ae08cdd9b
1 changed files with 3 additions and 0 deletions

View File

@ -15,6 +15,9 @@ export default function useSlugify(
);
const handleGenerateSlug = () => {
if (!source.value) {
return;
}
target.value = slugify(source.value, {
trim: true,
});