This commit is contained in:
姚俊旭 2025-05-28 15:11:44 +08:00
parent 1a53b90763
commit ada626f684
2 changed files with 13 additions and 9 deletions

View File

@ -66,7 +66,7 @@ const leftMenu = reactive([
name: 'control',
title: '物流',
icon: 'menu3.png',
path: '',
path: '/sub-operation-service/logistics',
isOpen: false,
children: [],
},
@ -77,7 +77,9 @@ let currentCIndex = ref('');
const toLink = (index) => {
currentIndex.value = index;
window.sessionStorage.setItem('currentOpen', index);
if (leftMenu[index].children.length > 0) {
window.sessionStorage.setItem('currentOpen', index);
}
if (index === 0) {
window.sessionStorage.setItem('currentChild', 'main');
}
@ -85,6 +87,7 @@ const toLink = (index) => {
let path = index !== undefined ? leftMenu[index].path : null;
if (path) {
router.push(path);
window.sessionStorage.setItem('currentParent', index);
}
};
const toLinkSub = (index, name) => {
@ -109,6 +112,7 @@ const openList = (index) => {
};
onMounted(() => {
currentIndex.value = window.sessionStorage.getItem('currentParent') ? Number(window.sessionStorage.getItem('currentParent')) : 0;
const currentMenu = window.sessionStorage.getItem('currentOpen');
if (currentMenu) {
for (let i in leftMenu) {
@ -117,7 +121,6 @@ onMounted(() => {
}
const currentChild = window.sessionStorage.getItem('currentChild');
if (currentChild && currentChild === 'main') {
currentIndex.value = 0;
currentCIndex.value = '';
} else if (currentChild) {
currentCIndex.value = currentChild;

View File

@ -1,17 +1,18 @@
<template>
<page-layout :menus="state.menus"> 物流 </page-layout>
<section>
<common>
<template #main> 物流 </template>
</common>
</section>
</template>
<script setup name="page-menu">
import { ref, reactive, watch } from 'vue';
import { getAssetsFile } from '@/utils';
import { useRoute, useRouter } from 'vue-router';
import warehouseLogisticsRoutes from '@/router/modules/warehouseLogistics';
import Common from '../components/common.vue';
const route = useRoute();
const router = useRouter();
const state = reactive({
menus: warehouseLogisticsRoutes[0].children,
});
</script>
<script setup></script>
<style lang="scss" scoped></style>