import Vue from 'vue' import Router from 'vue-router' import Home from '../views/index.vue' Vue.use(Router) export default new Router({ routes: [ { path: '/', name: '/', // 普通的写法 component: Home }, // 路由懒加载的第一种方式 (由Es6 提供的语法) { path: '/table', name: "table", component: () => import('@/views/table.vue') }, // 路由懒加载的第二种方式 (AMD 语法) { path: "/form", name: "form", component: resolve => require(['@/views/form.vue'], resolve) }, // 路由懒加载的第三种方式 (由webpack 提供的写法) { path: '/test', name: "test", component: resolve => require.ensure([], resolve('@/views/test.vue', 'test')) } ] })