mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-09 13:53:38 +08:00
feat: add horizontal nav (#45)
* feat: add horizontal nav * workflow: update linter.yml * fix: update * fix: update * fix: update * Rename Link.vue to link.vue * Rename SidebarItem.vue to sidebarItem.vue * Rename Logo.vue to logo.vue * Rename AppMain.vue to appMain.vue * Rename Navbar.vue to navbar.vue * fix: update * fix: update * fix: update * workflow: update linter.yml * fix: update * chore: update * workflow: update * fix: update * fix: update * fix: update * perf: 外链功能实现方式改变 * style: update nav style * perf: 优化国际化 * fix: update * fix: update
This commit is contained in:
@@ -4,8 +4,10 @@ import {
|
||||
RouteComponent,
|
||||
createWebHashHistory
|
||||
} from "vue-router";
|
||||
import { split } from "lodash-es";
|
||||
import { i18n } from "/@/plugins/i18n";
|
||||
import NProgress from "/@/utils/progress";
|
||||
import { openLink } from "/@/utils/link";
|
||||
import { storageSession, storageLocal } from "/@/utils/storage";
|
||||
import { usePermissionStoreHook } from "/@/store/modules/permission";
|
||||
|
||||
@@ -128,13 +130,20 @@ const whiteList = ["/login", "/register"];
|
||||
router.beforeEach((to, _from, next) => {
|
||||
const name = storageSession.getItem("info");
|
||||
NProgress.start();
|
||||
const externalLink = to?.redirectedFrom?.fullPath;
|
||||
// @ts-ignore
|
||||
const { t } = i18n.global;
|
||||
// @ts-ignore
|
||||
to.meta.title ? (document.title = t(to.meta.title)) : "";
|
||||
if (!externalLink) to.meta.title ? (document.title = t(to.meta.title)) : "";
|
||||
if (name) {
|
||||
if (_from?.name) {
|
||||
next();
|
||||
// 如果路由包含http 则是超链接 反之是普通路由
|
||||
if (externalLink && externalLink.includes("http")) {
|
||||
openLink(`http${split(externalLink, "http")[1]}`);
|
||||
NProgress.done();
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
} else {
|
||||
// 刷新
|
||||
if (usePermissionStoreHook().wholeRoutes.length === 0)
|
||||
|
||||
Reference in New Issue
Block a user