RuoYi
2022-03-30 d5f9b5b74a64cb1eeeab5fa503ba38122733d05f
topNav自定义隐藏侧边栏路由
已修改1个文件
14 ■■■■ 文件已修改
ruoyi-ui/src/components/TopNav/index.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/components/TopNav/index.vue
@@ -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 @@
    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);