解决过滤清理的问题

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, () => { watch(page, () => {
fetchArticles() fetchArticles()
@ -66,8 +68,9 @@ watch(page, () => {
}) })
// //
watch(() => route.query.code, (newCode) => { watch(() => route.query.code, (newCode, oldCode) => {
if (!newCode && newCode !== code.value) { // code
if (newCode !== oldCode) {
page.value = 1 page.value = 1
fetchArticles() 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"> <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> <span>当前筛选{{ articleTypeMap[code] || code }}</span>
<button <button
@click="router.push('/article')" @click="router.push('/article') "
class="text-blue-600 hover:text-blue-800 underline text-sm" class="text-blue-600 hover:text-blue-800 underline text-sm"
> >
清除筛选 清除筛选
@ -123,11 +126,14 @@ onMounted(() => {
root:'group', root:'group',
container: 'relative grid lg:grid-cols-[1fr_4fr] gap-8 p-6', 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" orientation="horizontal"
reverse reverse
spotlight spotlight
spotlight-color="primary" 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"> <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">