import Vue from "vue";
import VueRouter, { RouteConfig } from "vue-router";
import Home from "../views/Home.vue";
import Main from "../views/Main.vue";
import Summary from "../components/summary.vue";
import Video from "../components/video.vue";
import Integral from "../components/integral.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/login",
    name: "Login",
    meta: {
      title: "登录"
    },
    component: () => import("@/views/Login.vue")
  },
  {
    path: "/",
    component: Main,
    meta: {
      title: "首页"
    },
    children: [
      {
        path: "",
        name: "Home",
        meta: {
          title: "首页"
        },
        component: Home
      },
      {
        path: "/summary",
        name: "Summary",
        meta: {
          title: "概述"
        },
        component: Summary
      },
      {
        path: "/video",
        name: "Video",
        meta: {
          title: "视频列表"
        },
        component: Video
      },
      {
        path: "/integral",
        name: "Integral",
        meta: {
          title: "积分"
        },
        component: Integral
      }
    ]
  }
] as RouteConfig[];

const router = new VueRouter({
  routes
});

export default router;
