mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-11 05:07:28 +08:00
fix: keep browser history for home category and tag filters
This commit is contained in:
@@ -21,7 +21,7 @@ const props = defineProps({
|
|||||||
const gotoCategory = async () => {
|
const gotoCategory = async () => {
|
||||||
if (!props.category) return
|
if (!props.category) return
|
||||||
const value = encodeURIComponent(props.category.id ?? props.category.name)
|
const value = encodeURIComponent(props.category.id ?? props.category.name)
|
||||||
await navigateTo({ path: '/', query: { category: value } }, { replace: true })
|
await navigateTo({ path: '/', query: { category: value } })
|
||||||
}
|
}
|
||||||
|
|
||||||
const isImageIcon = (icon) => {
|
const isImageIcon = (icon) => {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ defineProps({
|
|||||||
|
|
||||||
const gotoTag = async (tag) => {
|
const gotoTag = async (tag) => {
|
||||||
const value = encodeURIComponent(tag.id ?? tag.name)
|
const value = encodeURIComponent(tag.id ?? tag.name)
|
||||||
await navigateTo({ path: '/', query: { tags: value } }, { replace: true })
|
await navigateTo({ path: '/', query: { tags: value } })
|
||||||
}
|
}
|
||||||
|
|
||||||
const isImageIcon = (icon) => {
|
const isImageIcon = (icon) => {
|
||||||
|
|||||||
@@ -357,13 +357,13 @@ const isImageIcon = (icon) => {
|
|||||||
|
|
||||||
const gotoCategory = (c) => {
|
const gotoCategory = (c) => {
|
||||||
const value = encodeURIComponent(c.id ?? c.name)
|
const value = encodeURIComponent(c.id ?? c.name)
|
||||||
navigateTo({ path: '/', query: { category: value } }, { replace: true })
|
navigateTo({ path: '/', query: { category: value } })
|
||||||
handleItemClick()
|
handleItemClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
const gotoTag = (t) => {
|
const gotoTag = (t) => {
|
||||||
const value = encodeURIComponent(t.id ?? t.name)
|
const value = encodeURIComponent(t.id ?? t.name)
|
||||||
navigateTo({ path: '/', query: { tags: value } }, { replace: true })
|
navigateTo({ path: '/', query: { tags: value } })
|
||||||
handleItemClick()
|
handleItemClick()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -170,9 +170,9 @@ watch(selected, (val) => {
|
|||||||
navigateTo(`/posts/${opt.postId}#comment-${opt.id}`, { replace: true })
|
navigateTo(`/posts/${opt.postId}#comment-${opt.id}`, { replace: true })
|
||||||
}
|
}
|
||||||
} else if (opt.type === 'category') {
|
} else if (opt.type === 'category') {
|
||||||
navigateTo({ path: '/', query: { category: opt.id } }, { replace: true })
|
navigateTo({ path: '/', query: { category: opt.id } })
|
||||||
} else if (opt.type === 'tag') {
|
} else if (opt.type === 'tag') {
|
||||||
navigateTo({ path: '/', query: { tags: opt.id } }, { replace: true })
|
navigateTo({ path: '/', query: { tags: opt.id } })
|
||||||
}
|
}
|
||||||
selected.value = null
|
selected.value = null
|
||||||
keyword.value = ''
|
keyword.value = ''
|
||||||
|
|||||||
@@ -643,7 +643,7 @@ const sendMessage = async () => {
|
|||||||
|
|
||||||
const gotoTag = (tag) => {
|
const gotoTag = (tag) => {
|
||||||
const value = encodeURIComponent(tag.id ?? tag.name)
|
const value = encodeURIComponent(tag.id ?? tag.name)
|
||||||
navigateTo({ path: '/', query: { tags: value } }, { replace: true })
|
navigateTo({ path: '/', query: { tags: value } })
|
||||||
}
|
}
|
||||||
|
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user