perf:去掉不必要的代码

This commit is contained in:
zouzhibing 2022-09-30 12:44:02 +08:00
parent 25cb558601
commit 0c9e11ce2a
4 changed files with 4 additions and 14 deletions

View File

@ -13,7 +13,7 @@
:key="tag.path"
class="item-tag-wrap"
:class="isActive(tag) ? 'active' : ''"
@click="routerGo(tag)"
@click.stop="routerGo(tag)"
>
<div class="tags-view-item">{{ tag.title }}</div>
<el-icon
@ -177,6 +177,7 @@
}
const routerGo = (tag) => {
console.log(111111111111)
router.push({
path: tag.path,
query: tag.query,

View File

@ -17,7 +17,7 @@ router.beforeEach(async(to, from, next) => {
if(typeof(to.meta.title) === 'string'){
document.title = to.meta.title ||'vue-admin-perfect'
}
const UserStore = useUserStore();
const UserStore = useUserStore();
// 确定用户是否已登录过存在Token
const hasToken = UserStore.token
if (hasToken) {
@ -46,7 +46,6 @@ router.beforeEach(async(to, from, next) => {
next()
} else {
next(`/login?redirect=${to.path}`)
}
}
})

View File

@ -4,16 +4,6 @@ import Layout from "@/layout/index.vue";
interface extendRoute {
hidden?:boolean
}
// * 导入所有router
const metaRouters = import.meta.globEager("./modules/*.ts");
// * 处理路由表
export const routerArray: RouteRecordRaw[] = [];
Object.keys(metaRouters).forEach(item => {
Object.keys(metaRouters[item]).forEach((key: any) => {
routerArray.push(...metaRouters[item][key]);
});
});
//
import tableRouter from './modules/table'
import dataScreenRouter from './modules/dataScreen'

View File

@ -43,7 +43,7 @@ export const usePermissionStore = defineStore({
this.cacheRoutes = []
},
getCacheRoutes(){
this.cacheRoutes = filterKeepAlive(routerArray)
this.cacheRoutes = filterKeepAlive(asyncRoutes)
return this.cacheRoutes
}
},