topNav自定义隐藏侧边栏路由

This commit is contained in:
RuoYi 2022-03-30 10:06:50 +08:00
parent b78949abad
commit 363051269e
1 changed files with 3 additions and 10 deletions

View File

@ -33,10 +33,10 @@ import { isHttp } from '@/utils/validate'
//
const visibleNumber = ref(null);
//
const isFrist = ref(null);
// index
const currentIndex = ref(null);
//
const hideList = ['/index', '/user/profile'];
const store = useStore();
const route = useRoute();
@ -88,17 +88,10 @@ const childrenMenus = computed(() => {
const activeMenu = computed(() => {
const path = route.path;
let activePath = path;
if (path !== undefined && path.lastIndexOf("/") > 0) {
if (path !== undefined && path.lastIndexOf("/") > 0 && hideList.indexOf(path) === -1) {
const tmpPath = path.substring(1, path.length);
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"));
store.dispatch('app/toggleSideBarHide', false);
} else if ("/index" == path || "" == path) {
if (!isFrist.value) {
isFrist.value = true;
} else {
activePath = "index";
}
store.dispatch('app/toggleSideBarHide', true);
} else if(!route.children) {
activePath = path;
store.dispatch('app/toggleSideBarHide', true);