fix: 页内菜单带参互相跳转,标签没有选中高亮

This commit is contained in:
xiaoxian521
2022-11-16 17:30:24 +08:00
parent 617f8e936c
commit facb09d779
4 changed files with 39 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
<script setup lang="ts">
import { ref } from "vue";
import { useI18n } from "vue-i18n";
import { useRoute } from "vue-router";
defineOptions({
name: "Menu1-2-2"
@@ -8,6 +9,7 @@ defineOptions({
const input = ref("");
const { t } = useI18n();
const { query } = useRoute();
</script>
<template>
@@ -16,5 +18,9 @@ const { t } = useI18n();
<p style="text-indent: 2em">{{ t("menus.hsmenu1-2") }}</p>
<p style="text-indent: 4em">{{ t("menus.hsmenu1-2-2") }}</p>
<el-input v-model="input" />
<div class="mt-4" v-if="query.text">
此页面携带的参数值为{{ query.text }}
</div>
</div>
</template>

View File

@@ -117,6 +117,28 @@ function onCloseTags() {
>
跳转页内菜单传path对象
</el-button>
<el-divider />
<el-button
@click="
$router.push({
name: 'Menu1-2-2',
query: { text: '传name对象优先推荐' }
})
"
>
携参跳转页内菜单传name对象优先推荐
</el-button>
<el-button
@click="
$router.push({
path: '/nested/menu1/menu1-2/menu1-2-2',
query: { text: '传path对象' }
})
"
>
携参跳转页内菜单传path对象
</el-button>
<el-link
class="ml-4"
href="https://router.vuejs.org/zh/guide/essentials/navigation.html#%E5%AF%BC%E8%88%AA%E5%88%B0%E4%B8%8D%E5%90%8C%E7%9A%84%E4%BD%8D%E7%BD%AE"