标签:world 异步 sse exp 懒加载 class web out res
import Vue from ‘vue‘ import Router from ‘vue-router‘ import Comment from ‘@/assets/view/comment.vue‘ Vue.use(Router) export default new Router({ routes: [ { path: ‘/‘, name: ‘comment‘, component: Comment } ] })
import Vue from ‘vue‘ import Router from ‘vue-router‘ const HelloWorld = () => import(‘@/components/HelloWorld‘)// 写法一 Vue.use(Router) export default new Router({ routes: [ { path: ‘/‘, name: ‘HelloWorld‘, component: HelloWorld //或者直接方法一写在这里 component: () => import("@/components/HelloWorld")// 写法二 } ] })
import Vue from ‘vue‘ import Router from ‘vue-router‘ Vue.use(Router) export default new Router({ routes: [ { path: ‘/‘, name: ‘HelloWorld‘, component: resolve => require([‘@/components/HelloWorld‘], resolve), } ] })
import Vue from ‘vue‘ import Router from ‘vue-router‘ const HelloWorld = r => require.ensure([], () => r(require(‘@/components/HelloWorld‘)), ‘HelloWorld‘) Vue.use(Router) export default new Router({ routes: [ { path: ‘/‘, name: ‘HelloWorld‘, component: HelloWorld } ] })
标签:world 异步 sse exp 懒加载 class web out res
原文地址:https://www.cnblogs.com/cl1998/p/13205180.html