解决过滤清理的问题

This commit is contained in:
WindowBird 2025-11-04 09:12:12 +08:00
parent 9873d293f0
commit 9b67af6323

View File

@ -58,6 +58,8 @@ const fetchArticles = async () => {
}
}
//
watch(page, () => {
fetchArticles()
@ -66,8 +68,9 @@ watch(page, () => {
})
//
watch(() => route.query.code, (newCode) => {
if (!newCode && newCode !== code.value) {
watch(() => route.query.code, (newCode, oldCode) => {
// code
if (newCode !== oldCode) {
page.value = 1
fetchArticles()
}
@ -90,7 +93,7 @@ onMounted(() => {
<div class="inline-flex items-center gap-2 px-4 py-2 bg-blue-50 text-blue-700 rounded-lg">
<span>当前筛选{{ articleTypeMap[code] || code }}</span>
<button
@click="router.push('/article')"
@click="router.push('/article') "
class="text-blue-600 hover:text-blue-800 underline text-sm"
>
清除筛选
@ -123,11 +126,14 @@ onMounted(() => {
root:'group',
container: 'relative grid lg:grid-cols-[1fr_4fr] gap-8 p-6',
}"
class="hover:shadow-2xl hover:scale-105 hover:translate-x-8"
class="hover:shadow-2xl hover:scale-105 hover:translate-x-8 [--spotlight-size:188px]"
orientation="horizontal"
reverse
spotlight
spotlight-color="primary"
highlight
highlight-color="primary"
>
<!-- 默认图片占位 -->
<div class="object-cover aspect-[4/3] w-full bg-gradient-to-br from-blue-100 to-blue-200 flex items-center justify-center rounded-lg">