fix: router

This commit is contained in:
xiaoxian521
2021-12-13 17:30:08 +08:00
parent e97bd9c8c4
commit 438aab9bfc
7 changed files with 73 additions and 58 deletions

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useRoute } from "vue-router";
const route = useRoute();
const index = route.params?.id ?? -1;
const index = route.query?.id ?? -1;
</script>
<template>

View File

@@ -9,7 +9,7 @@ const activeName = ref("tag");
function toDetail(index: number) {
useMultiTagsStoreHook().handleTags("push", {
path: `/tabs/detail/${index}`,
path: `/tabs/detail`,
parentPath: route.matched[0].path,
name: "tabDetail",
meta: {
@@ -20,7 +20,7 @@ function toDetail(index: number) {
realPath: "/tabs/detail"
}
});
router.push(`/tabs/detail/${index}`);
router.push({ name: "tabDetail", query: { id: index } });
}
</script>