1.this.$route.query的使用this
A、傳參數:url
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、傳參數:router
this.$router.push({
name: 'monitor',
params:{
id:id,
}
})
B、獲取參數:
this.$route.params.id
C、在url中形式(url中不帶參數)
http://172.19.186.224:8080/#/monitor
D、
頁面之間用路由跳轉傳參時,刷新跳轉後傳參的頁面,數據不存在(項目中遇到此問題)