慕仔8415870
2021-07-15 13:14
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import First from '@/components/First'
import A from '@/components/A'
import B from '@/components/B'
import A1 from '@/components/A1'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'First',
component: First,
children:[
{
path: '/a',
component: A
},
{
path: '/b',
componen :B
},
{
path: '/A1',
componen :A1
}
]
}
]
})
我的问题我自己解答,经过反复的更改,排除变量,发现是b,A1的router有问题。然后就复制了a的router,试了一下,ok了。
原因:没有注意router的代码语法规范。
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import First from '@/components/First'
import A from '@/components/A'
import B from '@/components/B'
import A1 from '@/components/A1'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'First',
component: First,
children:[
{
path: '/a',
component: A
},
{
path: '/b',
component: B
},
{
path: '/A1',
component: A1
}
]
}
]
})
vue-cli全集
44773 学习 · 230 问题
相似问题