import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router);
//获取原型对象上的push函数
const originalPush = Router.prototype.push
//修改原型对象中的push方法
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
export default new Router({
  routes: [
    {
      path:'/',
      name:'skip',
      component: resolve => {require(['@/view/skip'], resolve)}
    },
    {
      path:'/login',
      name:'login',
      component: resolve => {require(['@/view/login'], resolve)}
    },
    {
      path:'/home',
      name:'home',
      component: resolve => {require(['@/view/home'], resolve)}
    },
    // //测试
    // {
    //   path: '/HelloWorld',
    //   name: 'HelloWorld',
    //   component: resolve => {require(['@/components/HelloWorld'], resolve)}
    // },
    // {
    //   path: '/earth',
    //   name: 'earth',
    //   component: resolve => {require(['@/view/demo/earth'], resolve)}
    // },
    // {
    //   path: '/demo',
    //   name: 'demo',
    //   component: resolve => {require(['@/view/demo/demo'], resolve)}
    // },
    // {
    //   path: '/demoOne',
    //   name: 'demoOne',
    //   component: resolve => {require(['@/view/demo/demoOne'], resolve)}
    // },
    // {
    //   path: '/demoTwo',
    //   name: 'demoTwo',
    //   component: resolve => {require(['@/view/demo/demoTwo'], resolve)}
    // },
    // {
    //   path: '/newDemo',
    //   name: 'newDemo',
    //   component: resolve => {require(['@/view/demo/newDemo'], resolve)}
    // }
  ]
})
