xiangpei
2024-11-21 11f9869c2f0559ca995465410baf1deb44c226ce
src/components/TopNav/index.vue
@@ -33,7 +33,6 @@
<script>
import { constantRoutes } from "@/router";
import { isHttp } from "@/utils/validate";
// 隐藏侧边栏路由
const hideList = ['/index', '/user/profile'];
@@ -79,7 +78,7 @@
            if(router.path === "/") {
              router.children[item].path = "/" + router.children[item].path;
            } else {
              if(!isHttp(router.children[item].path)) {
              if(!this.ishttp(router.children[item].path)) {
                router.children[item].path = router.path + "/" + router.children[item].path;
              }
            }
@@ -125,9 +124,10 @@
    },
    // 菜单选择事件
    handleSelect(key, keyPath) {
      debugger;
      this.currentIndex = key;
      const route = this.routers.find(item => item.path === key);
      if (isHttp(key)) {
      if (this.ishttp(key)) {
        // http(s):// 路径新窗口打开
        window.open(key, "_blank");
      } else if (!route || !route.children) {
@@ -161,6 +161,9 @@
      } else {
        this.$store.dispatch('app/toggleSideBarHide', true);
      }
    },
    ishttp(url) {
      return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
    }
  },
};