123
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {createRouter, createWebHashHistory, RouteRecordRaw} from 'vue-router';
|
||||
import {useUserStore} from "@/store/modules/user";
|
||||
import {domainStoreWidthOut} from "@/store/modules/domain";
|
||||
import {getDomainList} from "@/api/login";
|
||||
|
||||
export const constantRouter: Array<RouteRecordRaw> = [
|
||||
{
|
||||
@@ -235,8 +236,15 @@ const router = createRouter({
|
||||
|
||||
|
||||
// @ts-ignore
|
||||
router.beforeEach((to, from, next) => {
|
||||
domainStoreWidthOut().refreshDomain();
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
const dsw = domainStoreWidthOut()
|
||||
if (!dsw.getDomain || dsw.getDomain.length == 0) {
|
||||
const response = await getDomainList()
|
||||
if (response && response.data) {
|
||||
const domain = response.data.split(',')
|
||||
dsw.setDomain(domain)
|
||||
}
|
||||
}
|
||||
if (to.meta.title) { // 判断是否有标题
|
||||
document.title = to.meta.title as string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user