vue之this.$route.params和this.$route.query的区别
1.this.$route.query的使用
A、传参数:
this.$router.push({
path: '/monitor',
query:{
id:id,
}
})
B、获取参数:
this.$route.query.id
C、在url中形式(url中带参数)
http://172.19.186.224:8080/#/monitor?id=1
D、页面之间用路由跳转传参时,刷新跳转后传参的页面,数据还会显示存在(项目中遇到此问题)
2.this.$route.params的使用
A、传参数:
this.$router.push({
name: 'monitor',
params:{
id:id,
}
})
B、获取参数:
this.$route.params.id
C、在url中形式(url中不带参数)
http://172.19.186.224:8080/#/monitor
D、页面之间用路由跳转传参时,刷新跳转后传参的页面,数据不存在(项目中遇到此问题)
posted on 2018-12-21 17:01 平平淡淡summer 阅读(31529) 评论(0) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步