您的位置:首页 > 产品设计 > UI/UE

vue.js学习笔记--遇到的那些问题

2017-04-27 11:26 621 查看
问题:配置main.js,vue-router中router-view无法渲染,采用如下方式配置:
Vue.use(VueRouter)
const routes=[{
path:'/',
component:home
},{
path:"/hello",
component:Hello
}]
const  router = new VueRouter({
routes
})

new Vue({
el: '#app',
router,
template:"<App/>",
components:{
App
}
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

在定义路由数组时,该数组名称请以routes命名,若命名不是这个,会导致渲染错误,也可以参考如下方式:
const r=[{
path:'/',
component:home
},{
path:"/hello",
component:Hello
}]
const  router = new VueRouter({
routes`**重点内容**r
})
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: