【发布时间】:2019-07-01 09:22:34
【问题描述】:
下面的代码抛出unexpected token import
const Router = new VueRouter({
routes: [
{ path: '', component: () => import('pages/landing/landing') }
]
})
如果我喜欢以下内容,它就可以工作:
import landing from 'pages/landing/landing';
const LandingComp = Vue.component('search-product', landing);
const Router = new VueRouter({
routes: [
{ path: '', component: LandingComp }
]
})
但我不想一开始就加载所有组件。我想在需要时动态加载。
任何帮助将不胜感激。谢谢!
【问题讨论】:
标签: vue.js vue-router