修复左侧布局无法展开的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" theme="dark"
mode="inline" mode="inline"
v-model:selectedKeys="selectedKeys" v-model:selectedKeys="selectedKeys"
v-model:openKeys="openKeys"
> >
<vab-menu v-for="route in routes" :key="route.path" :item="route" /> <vab-menu v-for="route in routes" :key="route.path" :item="route" />
</a-menu> </a-menu>
@ -72,7 +73,8 @@
}, },
data() { data() {
return { return {
selectedKeys: ['/index'], selectedKeys: [],
openKeys: [],
} }
}, },
computed: { computed: {
@ -90,11 +92,12 @@
}, },
watch: { watch: {
$route: { $route: {
handler({ fullPath }) { handler({ fullPath, matched }) {
// //
if (fullPath === '/index') fullPath = '/' if (fullPath === '/index') fullPath = '/'
if (fullPath === '/test/test') fullPath = '/test' if (fullPath === '/test/test') fullPath = '/test'
this.selectedKeys = [fullPath] this.selectedKeys = [fullPath]
this.openKeys = [matched[0].path]
}, },
immediate: true, immediate: true,
}, },