🐞 fix: 修复搜索类型切换 没有重新加载搜索的问题(#25)

closed #25
This commit is contained in:
alger
2025-01-03 21:28:48 +08:00
parent cdb9524f04
commit ba64631a17
2 changed files with 14 additions and 1 deletions

View File

@@ -175,13 +175,17 @@ const search = () => {
router.push({
path: '/search',
query: {
keyword: value
keyword: value,
type: store.state.searchType
}
});
};
const selectSearchType = (key: number) => {
store.state.searchType = key;
if (searchValue.value) {
search();
}
};
const searchTypeOptions = ref(SEARCH_TYPES);

View File

@@ -104,6 +104,15 @@ watch(
}
);
watch(
() => searchType.value,
() => {
if (store.state.searchValue) {
loadSearch(store.state.searchValue);
}
}
);
const dateFormat = (time: any) => useDateFormat(time, 'YYYY.MM.DD').value;
const loadSearch = async (keywords: any, type: any = null) => {
hotKeyword.value = keywords;