integrated_traffic_vue/src/router/index.js

107 lines
2.6 KiB
JavaScript

import { createRouter, createWebHashHistory } from "vue-router";
import layout from "../layout/index.vue";
import children from "../components/children/index.vue";
const routes = [
{
path: "/login",
name: "/login",
meta: { title: "登录", isLogin: false },
component: () => import("@/views/login/index"),
},
{
path: "/",
name: "app",
redirect: "/index",
meta: { title: "首页" },
component: layout,
children: [
{
path: "/index",
name: "/index",
meta: {
title: "首页",
breadcrumb: false,
isMenu: false,
isSubMenu: false,
},
component: () => import("@/views/index/index"),
},
],
},
{
path: "/mobile",
meta: { isBreadcrumb: false, isMenu: false, isLogin: false },
component: children,
children: [
{
path: "information",
component: () => import("@/mobile/information/index"),
},
{
path: "identifying_parts",
component: children,
children: [
{
path: "index",
component: () => import("@/mobile/identifying_parts/index.vue"),
},
{
path: "inspection_record",
component: () =>
import("@/mobile/identifying_parts/inspection_record.vue"),
},
{
path: "hidden_danger_view",
component: () =>
import("@/mobile/identifying_parts/hidden_danger_view.vue"),
},
],
},
{
path: "risk_point",
component: children,
children: [
{
path: "index",
component: () => import("@/mobile/risk_point/index.vue"),
},
{
path: "checklist",
component: () => import("@/mobile/risk_point/checklist.vue"),
},
{
path: "inspection_record",
component: () =>
import("@/mobile/risk_point/inspection_record.vue"),
},
{
path: "hidden_danger_view",
component: () =>
import("@/mobile/risk_point/hidden_danger_view.vue"),
},
],
},
],
},
{
path: "/404",
name: "/404",
meta: { title: "404", isBreadcrumb: false, isMenu: false },
component: () => import("@/views/404"),
},
];
const router = createRouter({
history: createWebHashHistory(import.meta.env.BASE_URL),
routes,
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition;
} else {
return { left: 0, top: 0 };
}
},
});
export default router;