This commit is contained in:
Ah jung
2021-07-17 16:24:49 +08:00
parent 3cb7a7f54f
commit 770d39871a
5 changed files with 41 additions and 60 deletions

View File

@@ -74,6 +74,9 @@ export default defineComponent({
watch(
() => currentRoute.fullPath,
() => {
const matched = currentRoute.matched
const getOpenKeys = matched && matched.length ? [matched[0]?.name] : []
state.openKeys = getOpenKeys
state.selectedKeys = currentRoute.name
}
)
@@ -89,6 +92,7 @@ export default defineComponent({
//展开菜单
function menuExpanded(openKeys: string[]) {
console.log(openKeys)
if (!openKeys) return
const latestOpenKey = openKeys.pop();
state.openKeys = latestOpenKey ? [latestOpenKey] : []