topNav自定义隐藏侧边栏路由

This commit is contained in:
RuoYi 2022-03-30 10:38:51 +08:00
parent 2043d1f439
commit d5f9b5b74a

View File

@ -30,13 +30,14 @@
<script>
import { constantRoutes } from "@/router";
//
const hideList = ['/index', '/user/profile'];
export default {
data() {
return {
//
visibleNumber: 5,
//
isFrist: false,
// index
currentIndex: undefined
};
@ -88,17 +89,10 @@ export default {
activeMenu() {
const path = this.$route.path;
let activePath = path;
if (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("/"));
this.$store.dispatch('app/toggleSideBarHide', false);
} else if ("/index" == path || "" == path) {
if (!this.isFrist) {
this.isFrist = true;
} else {
activePath = "index";
}
this.$store.dispatch('app/toggleSideBarHide', true);
} else if(!this.$route.children) {
activePath = path;
this.$store.dispatch('app/toggleSideBarHide', true);