Skip to content

Commit

Permalink
refactor: use vue router instead
Browse files Browse the repository at this point in the history
  • Loading branch information
StarHeartHunt committed Oct 30, 2023
1 parent 8263d21 commit c7f0891
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { ref } from "vue";
import { NInput, NLayout } from "naive-ui";
import { storeToRefs } from "pinia";
import { useRouter } from "vue-router";
import ResultTable from "@/components/result-table/ResultTable.vue";
import { usePageStore } from "@/stores/page";
import { debounce } from "@/utils/wrapper";
const props = defineProps<{ searchKeyword?: string }>();
const router = useRouter();
const store = usePageStore();
const { plugins, results } = storeToRefs(store);
Expand All @@ -17,9 +19,7 @@ const searchKeyword = ref<string>(
);
const handleSearch = debounce((v: string) => {
const url = new URL(`${window.location.origin}/search`);
url.searchParams.append("q", v);
window.history.replaceState(null, null, url)
router.push({ path: "/search", query: { q: v } });
}, 600);
</script>

Expand Down

0 comments on commit c7f0891

Please sign in to comment.