import {
	createRouter,
	createWebHashHistory,
} from "vue-router";

const routes = [
	{
		path: "/",
		redirect: "/index"
	},
	{
		icon: "menuIcon el-icon el-icon-s-home", // 菜单所用 icon 
		path: "/index", // 菜单 path
		name: "首页", // 菜单显示的名称
		component: () => import("../views/layout/home.vue"),
	},
	{
		icon: "menuIcon el-icon el-icon-postcard",
		path: "/sample",
		name: "样本",
		component: () => import("../views/sample/router/index.vue"),
		children: [{
			path: "fault",
			name: "故障样本",
			component: () => import("../views/sample/realfault.vue"),
		},
		{
			path: "diagnose",
			name: "诊断样本",
			component: () => import("../views/sample/diagnosefault.vue"),
		}]
	},
	{
		icon: "menuIcon el-icon el-icon-document",
		path: "/know",
		name: "知识库",
		component: () => import("../views/know/router/index.vue"),
		children: [{
			path: "station",
			name: "故障分类",
			component: () => import("../views/know/faultcategory.vue"),
		}]
	},
	{
		icon: "menuIcon el-icon el-icon-info",
		path: "/info",
		name: "基础配置",
		component: () => import("../views/basicinfo/router/index.vue"),
		children: [{
			path: "station",
			name: "场站数据",
			component: () => import("../views/basicinfo/station.vue"),
		}]
	},
	{
		path: "/:catchAll(.*)",
		name: "404",
		component: () => import("../views/404.vue"),
	},
];

const router = createRouter({
	history: createWebHashHistory(),
	routes
});

// router.beforeEach((to, from, next) => {
	
// 	next();
// });

export default router;