import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import DevCenter from "../views/DevCenter.vue";
import ErrorPage from "../views/404.vue"

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    name: "Home",
    component: Home,
  },
  {
    path: "/devCenter",
    name: "devCenter",
    component: DevCenter,
  },
  {
    path: "/404",
    name: "404",
    component: ErrorPage,
  },
  { path: "*", redirect: "/404" }
];

const router = new VueRouter({
  routes,
});

// router.beforeEach((to, from, next) => {
//   /* 路由发生变化修改页面title */
//   if (to.meta.title) {
//     document.title = to.meta.title
//   }
//   next()
// })

export default router;
