import Vue from "vue";
import VueRouter from "vue-router";

// 处理统一路由跳转的问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
// const VueRouterReplace = VueRouter.prototype.replace
// VueRouter.prototype.replace = function replace(to) {
//   return VueRouterReplace.call(this, to).catch(err => err)
// }

Vue.use(VueRouter);

const routes = [{
  path: "/",
  component: () => import( /* webpackChunkName: "home" */ "../views/Home.vue"),
  // children: [
  //   {
  //     path: "/",
  //     name: "Default",
  //     component: () => import( /* webpackChunkName: "Default" */ "../views/Default.vue"),
  //   },
  //   {
  //     path: "/MetadataListContainer",
  //     name: "MetadataListContainer",
  //     component: () => import( /* webpackChunkName: "MetadataListContainer" */ "../views/MetadataListContainer.vue"),
  //   },
  //   {
  //     path: "/ModelManagement",
  //     name: "ModelManagement",
  //     component: () => import( /* webpackChunkName: "ModelManagement" */ "../views/ModelManagement.vue"),
  //   },
  // ]
}, {
  path: "/error",
  component: () => import( /* webpackChunkName: "error" */ "../views/Error.vue"),
}
];

const router = new VueRouter({
  mode: 'history',
  routes,
});

export default router;
