'admin-21.05.31:修复分栏、经典布局路由设置meta.isHide为true时报错问题,感谢群友@29、@芭芭拉'

This commit is contained in:
lyt-Top 2021-05-31 21:42:31 +08:00
parent 80a88495fb
commit 2c1ffb7369
5 changed files with 11 additions and 18 deletions

View File

@ -8,4 +8,5 @@
- 🎉 新增 更新日志文件 `CHANGELOG.md`,以后每次更新都会在这里显示对应内容 - 🎉 新增 更新日志文件 `CHANGELOG.md`,以后每次更新都会在这里显示对应内容
- 🌟 更新 依赖更新最新版本 - 🌟 更新 依赖更新最新版本
- 🐞 修复 分栏布局路由设置 `meta.isHide``true` 时报错问题,感谢群友@29 - 🐞 修复 分栏、经典布局路由设置 `meta.isHide``true` 时报错问题,感谢群友@29、@芭芭拉
- 🐞 修复 经典布局点击 `tagsView` 左侧菜单数据不变问题

View File

@ -85,9 +85,8 @@ export default {
proxy.$refs.layoutAsideScrollbarRef.update(); proxy.$refs.layoutAsideScrollbarRef.update();
} }
}); });
// // vuex
watch(store.state, (val) => { watch(store.state, (val) => {
if (val.routesList.routesList.length === state.menuList.length) return false;
let { layout, isClassicSplitMenu } = val.themeConfig.themeConfig; let { layout, isClassicSplitMenu } = val.themeConfig.themeConfig;
if (layout === 'classic' && isClassicSplitMenu) return false; if (layout === 'classic' && isClassicSplitMenu) return false;
setFilterRoutes(); setFilterRoutes();

View File

@ -132,11 +132,9 @@ export default {
onColumnsAsideDown(currentSplitRoute.k); onColumnsAsideDown(currentSplitRoute.k);
}, 0); }, 0);
}; };
// //
watch(store.state, (val) => { watch(store.state, (val) => {
val.themeConfig.themeConfig.columnsAsideStyle === 'columnsRound' ? (state.difference = 3) : (state.difference = 0); val.themeConfig.themeConfig.columnsAsideStyle === 'columnsRound' ? (state.difference = 3) : (state.difference = 0);
if (val.routesList.routesList.length === state.columnsAsideList.length) return false;
setFilterRoutes();
}); });
// //
onMounted(() => { onMounted(() => {

View File

@ -8,7 +8,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { computed, reactive, toRefs, onMounted, onUnmounted, getCurrentInstance, watch } from 'vue'; import { computed, reactive, toRefs, onMounted, onUnmounted, getCurrentInstance } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useStore } from '/@/store/index.ts'; import { useStore } from '/@/store/index.ts';
import Breadcrumb from '/@/views/layout/navBars/breadcrumb/breadcrumb.vue'; import Breadcrumb from '/@/views/layout/navBars/breadcrumb/breadcrumb.vue';
@ -81,11 +81,6 @@ export default {
}); });
return currentData; return currentData;
}; };
//
watch(store.state, (val) => {
if (val.routesList.routesList.length === state.menuList.length) return false;
setFilterRoutes();
});
// //
onMounted(() => { onMounted(() => {
setFilterRoutes(); setFilterRoutes();

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="el-menu-horizontal-warp"> <div class="el-menu-horizontal-warp">
<el-scrollbar @wheel.native.prevent="onElMenuHorizontalScroll" ref="elMenuHorizontalScrollRef"> <el-scrollbar @wheel.native.prevent="onElMenuHorizontalScroll" ref="elMenuHorizontalScrollRef">
<el-menu router :default-active="defaultActive" background-color="transparent" mode="horizontal" @select="onHorizontalSelect"> <el-menu router :default-active="defaultActive" background-color="transparent" mode="horizontal">
<template v-for="val in menuLists"> <template v-for="val in menuLists">
<el-submenu :index="val.path" v-if="val.children && val.children.length > 0" :key="val.path"> <el-submenu :index="val.path" v-if="val.children && val.children.length > 0" :key="val.path">
<template #title> <template #title>
@ -99,10 +99,6 @@ export default defineComponent({
}); });
return currentData; return currentData;
}; };
//
const onHorizontalSelect = (path: string) => {
proxy.mittBus.emit('setSendClassicChildren', setSendClassicChildren(path));
};
// //
onMounted(() => { onMounted(() => {
initElMenuOffsetLeft(); initElMenuOffsetLeft();
@ -112,11 +108,15 @@ export default defineComponent({
onBeforeRouteUpdate((to) => { onBeforeRouteUpdate((to) => {
setCurrentRouterHighlight(to.path); setCurrentRouterHighlight(to.path);
proxy.mittBus.emit('onMenuClick'); proxy.mittBus.emit('onMenuClick');
// tagsView
let { layout, isClassicSplitMenu } = store.state.themeConfig.themeConfig;
if (layout === 'classic' && isClassicSplitMenu) {
proxy.mittBus.emit('setSendClassicChildren', setSendClassicChildren(to.path));
}
}); });
return { return {
menuLists, menuLists,
onElMenuHorizontalScroll, onElMenuHorizontalScroll,
onHorizontalSelect,
...toRefs(state), ...toRefs(state),
}; };
}, },