赞
踩
命名的路由 params传递的参数相当与发送了一次post请求,请求参数则不会显示,并且刷新页面之后参数会消失
传递参数(貌似是不能传递对象及数组类型):
this.$router.push({ name:'Login', params: { id: this.id } )
接收参数:
this.$route.params.id
二,path跳转页面
对象 query相当与发送了一次get请求,请求参数会显示在浏览器地址栏中
(1)不传递参数单纯跳转
this.$router.push('/task/index')
(2)传递字符串及其他非对象数据
- this.$router.push({
- path: '/task/index',
- query: {
- procInsId: record.procInsId,
- deployId: record.deployId,
- finished: true
- }
- })
接收参数:
this.$route.query && this.$route.query.deployId
(3)传递对象类型数据
传递当行所有数据record是一个对象{id:'',name:''}
this.$router.push({path: '/task/index',query:{...record}});
接收参数:
this.$route.query
注:this.$router.currentRoute.query知识点
router.currentRoute 相当于 $route
详情信息:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。