两种push
this.$router.push({ name:'list', param: {id: id}});
优点是不会在url中展示出来,
缺点是刷新页面数据就会丢失 undefined
this.$router.push({ path: '/list', query: { id: id}})
path配合query的写法参数id会拼在url中,刷新还在;
当用这种方式传递的参数是一个Object时,刷新页面后对象会变成[object,Object],需要用JSON封装成json对象就可以解决变成object的问题
//封装参数:
this.$router.push({ path: '/list', query:{ row: JSON.stringify(row)}})
//解析参数:
JSON.parse(this.$route.query.row)