Update public layout logic

This commit is contained in:
chuzhixin 2020-10-28 09:49:04 +08:00
parent 96de07d09a
commit cb41ab4f8a
3 changed files with 6 additions and 7 deletions

View File

@ -92,11 +92,10 @@
}, },
watch: { watch: {
$route: { $route: {
handler({ fullPath, matched }) { handler({ path, matched }) {
// matched[0].children.length > 1
if (fullPath === '/index') fullPath = '/' ? (this.selectedKeys = [path])
if (fullPath === '/test/test') fullPath = '/test' : (this.selectedKeys = [matched[0].path])
this.selectedKeys = [fullPath]
this.openKeys = [matched[0].path] this.openKeys = [matched[0].path]
}, },
immediate: true, immediate: true,

View File

@ -1,5 +1,5 @@
<template> <template>
<a-menu-item :key="routeChildren.fullPath" @click="handleLink"> <a-menu-item :key="routeChildren.path" @click="handleLink">
<span class="anticon"> <span class="anticon">
<vab-icon :icon="routeChildren.meta.icon"></vab-icon> <vab-icon :icon="routeChildren.meta.icon"></vab-icon>
</span> </span>

View File

@ -8,7 +8,7 @@
<template v-if="item.children && item.children.length"> <template v-if="item.children && item.children.length">
<vab-menu <vab-menu
v-for="route in item.children" v-for="route in item.children"
:key="route.fullPath" :key="route.path"
:item="route" :item="route"
></vab-menu> ></vab-menu>
</template> </template>