feat: include categories and tags in global search

This commit is contained in:
Tim
2025-07-31 12:52:25 +08:00
parent aa38c2e5e1
commit d4bfef36f7
4 changed files with 51 additions and 5 deletions

View File

@@ -74,7 +74,9 @@ export default {
const iconMap = {
user: 'fas fa-user',
post: 'fas fa-file-alt',
comment: 'fas fa-comment'
comment: 'fas fa-comment',
category: 'fas fa-folder',
tag: 'fas fa-hashtag'
}
watch(selected, val => {
@@ -89,6 +91,10 @@ export default {
if (opt.postId) {
router.push(`/posts/${opt.postId}#comment-${opt.id}`)
}
} else if (opt.type === 'category') {
router.push({ path: '/', query: { category: opt.id } })
} else if (opt.type === 'tag') {
router.push({ path: '/', query: { tags: opt.id } })
}
selected.value = null
keyword.value = ''