通过路由用query形式传参
1 | this.$router.push({ |
在打开的页面中取数据
1 | this.cam = this.$route.query.cam; |
如不将数据展示在地址栏中,可以使用params进行传参。用法和query类似。但是一刷新数据就不见了,可以再借助vuex,localStorage等进行存储。
1 | this.$router.push({name: 'ShowVideo',params:{cam: this.cam}}) |
如需要在新页面中打开
1 | let routeUrl = this.$router.resolve({ |
返回上一页
1 | this.$router.go(-1); |