mirror of https://github.com/halo-dev/halo-admin
fix: the issue that the useSlugify hook may cause the value to be undefined (#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/886/head
parent
a8166e5336
commit
94903646f6
|
@ -15,6 +15,9 @@ export default function useSlugify(
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleGenerateSlug = () => {
|
const handleGenerateSlug = () => {
|
||||||
|
if (!source.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
target.value = slugify(source.value, {
|
target.value = slugify(source.value, {
|
||||||
trim: true,
|
trim: true,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue