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
}
]
})