修复左侧布局无法展开的bug

This commit is contained in:
chuzhixin 2020-10-16 14:27:22 +08:00
parent d5e038d91f
commit f00b4a47fe

View File

@ -19,6 +19,7 @@
theme="dark"
mode="inline"
v-model:selectedKeys="selectedKeys"
v-model:openKeys="openKeys"
>
<vab-menu v-for="route in routes" :key="route.path" :item="route" />
</a-menu>
@ -72,7 +73,8 @@
},
data() {
return {
selectedKeys: ['/index'],
selectedKeys: [],
openKeys: [],
}
},
computed: {
@ -90,11 +92,12 @@
},
watch: {
$route: {
handler({ fullPath }) {
handler({ fullPath, matched }) {
//
if (fullPath === '/index') fullPath = '/'
if (fullPath === '/test/test') fullPath = '/test'
this.selectedKeys = [fullPath]
this.openKeys = [matched[0].path]
},
immediate: true,
},