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:
啝裳
2021-09-29 01:55:56 +08:00
committed by GitHub
parent e86757e30e
commit fd8de45bff
31 changed files with 1314 additions and 682 deletions

View File

@@ -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)