import Vue from "vue";
import VueRouter from "vue-router";
// 布局
import Layout from "../views/layout/";
Vue.use(VueRouter);
// 路由格式统一采用这种默认chuank打包方式，统一写法，非必要不要擅改
const routes = [
  {
    path: "/",
    component: Layout,
    children: [
      {
        path: "/",
        redirect: "/index", // 页面重定向
      },
      {
        // 主页
        path: "/index",
        name: "Index",
        component: () =>
          import(/* webpackChunkName: "Index" */ "../views/index"),
      },
      {
        // 预约流程
        path: "/flow",
        name: "Flow",
        component: () =>
          import(/* webpackChunkName: "Index" */ "../views/flow"),
      },
    ],
  },
  {
    // 登陆
    path: "/login",
    name: "Login",
    component: () => import(/* webpackChunkName: "Index" */ "../views/login"),
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
