mirror of https://github.com/halo-dev/halo
fix: search issue of post tag selection component (#3540)
#### What type of PR is this? /kind bug /area console #### What this PR does / why we need it: 修复 FormKit 的文章标签搜索组件无法使用搜索功能的问题。 <img width="720" alt="image" src="https://user-images.githubusercontent.com/21301288/226311996-8f31bc6c-784e-4bf0-93da-cdc6db935822.png"> #### Which issue(s) this PR fixes: Fixed https://github.com/halo-dev/halo/issues/3536 #### Special notes for your reviewer: 测试方式: 1. 在文章设置中,测试标签选择输入框的搜索功能是否正常即可。 #### Does this PR introduce a user-facing change? ```release-note 修复文章设置中的标签选择组件无法正常搜索的问题。 ```pull/3543/head
parent
5bc4a63e59
commit
e6d2607516
|
@ -52,11 +52,11 @@ const { tags: postTags, handleFetchTags } = usePostTag();
|
||||||
let fuse: Fuse<Tag> | undefined = undefined;
|
let fuse: Fuse<Tag> | undefined = undefined;
|
||||||
|
|
||||||
const searchResults = computed(() => {
|
const searchResults = computed(() => {
|
||||||
if (!fuse || !text.value) {
|
if (!text.value) {
|
||||||
return postTags.value;
|
return postTags.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fuse?.search(text.value).map((item) => item.item);
|
return fuse?.search(text.value).map((item) => item.item) || [];
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
Loading…
Reference in New Issue