个人分类: vuejs框架学习
1.路径:http://localhost:8081/#/test?name=1

router-link:to="{path:’/test’,query:{name:id}}"跳转
id是参数
使用this.$route.query.id
2.路径:http://localhost:8081/#/test/1

跳转 (id是参数)
路由:
{
path: ‘/test/:id’,
name: ‘Test’,
component:require(’./components/Test.vue’)
}
使用:this. r o u t e . p a r a m s . i d ( 这 个 i d 和 上 图 路 由 的 配 置 有 关 ) t h i s . route.params.id (这个id和上图路由的配置有关) this. route.params.ididthis.route是一个数组,里面包含路由的所有信息
注意:router-link中链接如果是‘/’开始就是从根路由开始,如果开始不带‘/’,则从当前路由开始
转自博客:https://blog.csdn.net/sangjinchao/article/details/70888259

Logo

前往低代码交流专区

更多推荐