修改路由守卫

This commit is contained in:
hzz 2023-08-07 10:28:46 +08:00
parent c0e58d2994
commit 18ca4ba0f7

View File

@ -32,14 +32,6 @@ const routes: Array<RouteRecordRaw> = [
component: () =>
import(/* webpackChunkName: "about" */ "../views/demo/demo.vue"),
},
{
path: "/index",
name: "index",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import("../views/index.vue"),
},
{
path: "/environment",
name: "environment",
@ -61,15 +53,13 @@ const routes: Array<RouteRecordRaw> = [
{
path: "/energyConsume",
name: "energyConsume",
component: () => import("../views/energyConsume/index.vue"),
children: [
{
path: "/energyConsume/historyData",
name: 'historyData',
component: () =>
import("../views/energyConsume/content/child/historyData.vue"),
},
],
component: () => import("../views/energyConsume/index.vue")
},
{
path: "/energyConsume/historyData",
name: 'historyData',
component: () =>
import("../views/energyConsume/content/child/historyData.vue"),
},
{
path: "/InPlantProducts",
@ -332,9 +322,9 @@ router.beforeEach(async (to: any, from, next) => {
let hash = to.query.hash
let arr = [
'legionProducts', 'devItem', 'tufting', 'Winding', 'Large_Format',
'GetonAgain', 'OffsiteDevList', 'Mechanicschild', 'Mechanicsson', 'jixieHistoryData'
'GetonAgain', 'OffsiteDevList', 'Mechanicschild', 'Mechanicsson','historyData', 'jixieHistoryData'
]
// 返回 false 以取消导航
if (to.path == "/") {
sessionStorage.setItem("screen_hash", to.query.hash);