Browse Source

topNav自定义隐藏侧边栏路由

tags/v3.5.0
RuoYi 3 years ago
parent
commit
a70d5ee2ab
  1. 14
      ruoyi-ui/src/components/TopNav/index.vue
  2. 2
      ruoyi-ui/src/layout/index.vue

14
ruoyi-ui/src/components/TopNav/index.vue

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

2
ruoyi-ui/src/layout/index.vue

@ -102,7 +102,7 @@ export default {
} }
.sidebarHide .fixed-header { .sidebarHide .fixed-header {
width: calc(100%); width: 100%;
} }
.mobile .fixed-header { .mobile .fixed-header {

Loading…
Cancel
Save