Skip to content

Commit

Permalink
fix: fix navigate back not updated
Browse files Browse the repository at this point in the history
  • Loading branch information
StarHeartHunt committed Oct 30, 2023
1 parent c7f0891 commit 6684686
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const themeOverrides: GlobalThemeOverrides = {
<n-layout
class="my-3 w-full lg:max-w-[90rem] max-w-3xl mx-auto px-4 sm:px-6 md:px-8"
>
<router-view></router-view>
<router-view :key="$route.fullPath"></router-view>
</n-layout>
<Footer></Footer>
<n-back-top />
Expand Down
8 changes: 5 additions & 3 deletions src/components/Table.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref } from "vue";
import { ref, watch } from "vue";
import { NInput, NLayout } from "naive-ui";
import { storeToRefs } from "pinia";
Expand All @@ -17,10 +17,13 @@ const { plugins, results } = storeToRefs(store);
const searchKeyword = ref<string>(
props.searchKeyword ? props.searchKeyword : "",
);
const handleSearch = debounce((v: string) => {
router.push({ path: "/search", query: { q: v } });
}, 600);
watch(searchKeyword, async (newValue) => {
handleSearch(newValue);
});
</script>

<template>
Expand All @@ -31,7 +34,6 @@ const handleSearch = debounce((v: string) => {
type="text"
placeholder="搜索"
clearable
@input="handleSearch"
/>
</n-layout>
<n-layout class="mt-3">
Expand Down

0 comments on commit 6684686

Please sign in to comment.