mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
fix: 修复layout菜单折叠不更新状态问题
This commit is contained in:
parent
eb4c2d92f9
commit
270d116dfd
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<f-menu
|
<f-menu
|
||||||
:modelValue="activePath"
|
:modelValue="activePath"
|
||||||
:expandedKeys="defaultExpandMenu"
|
:expandedKeys="expandedKeysRef"
|
||||||
:inverted="inverted"
|
:inverted="inverted"
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
:options="transformedMenus"
|
:options="transformedMenus"
|
||||||
@ -12,7 +12,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { computed, h } from 'vue';
|
import { computed, h, ref } from 'vue';
|
||||||
import { FMenu } from '@fesjs/fes-design';
|
import { FMenu } from '@fesjs/fes-design';
|
||||||
import { useRoute, useRouter } from '@@/core/coreExports';
|
import { useRoute, useRouter } from '@@/core/coreExports';
|
||||||
import { transform as transformByAccess } from '../helpers/pluginAccess';
|
import { transform as transformByAccess } from '../helpers/pluginAccess';
|
||||||
@ -94,7 +94,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return matchMenus[0].path;
|
return matchMenus[0].path;
|
||||||
});
|
});
|
||||||
const defaultExpandMenu = computed(() => {
|
const getDefaultExpandMenu = () => {
|
||||||
let index = menuArray.value.findIndex((item) => item.value === activePath.value);
|
let index = menuArray.value.findIndex((item) => item.value === activePath.value);
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
return props.expandedKeys;
|
return props.expandedKeys;
|
||||||
@ -109,7 +109,8 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return props.expandedKeys.concat(arr.map((item) => item.value));
|
return props.expandedKeys.concat(arr.map((item) => item.value));
|
||||||
});
|
};
|
||||||
|
const expandedKeysRef = ref(getDefaultExpandMenu());
|
||||||
const onMenuClick = (e) => {
|
const onMenuClick = (e) => {
|
||||||
const path = e.value;
|
const path = e.value;
|
||||||
if (/^https?:\/\//.test(path)) {
|
if (/^https?:\/\//.test(path)) {
|
||||||
@ -122,7 +123,7 @@ export default {
|
|||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
activePath,
|
activePath,
|
||||||
defaultExpandMenu,
|
expandedKeysRef,
|
||||||
transformedMenus,
|
transformedMenus,
|
||||||
onMenuClick,
|
onMenuClick,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user