vue带有参数的路由跳转
2018-06-01 10:16
260 查看
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_27848369/article/details/80534156
vue带有参数的路由跳转:
1. 接收路由传递的参数有两种方式; (this.$router.history.current.params 、 this.$route.params)
2. 为避免在跳转页面F5数据丢失,需要将传递的参数存到sessionStorage
3. 跳转的地方,路由跳转时, 不可使用 path, 要使用name。 (path适用于不带参数的跳转)
created(){
let info = this.$router.history.current.params.info;
// let info = this.$route.params.info;
if (info) {
sessionStorage.setItem("detailItem12", info);
}
let houseId = sessionStorage.getItem("detailItem12") + '';
this.houseId = houseId;
},
gotoDetailPage: function (index, rowData) {
let routerName = '';
if (rowData.houseLivedState == 1) {
routerName = 'HouseDetail1';
}else if(rowData.houseLivedState == 2){
routerName = 'HouseDetail2';
}else if(rowData.houseLivedState == 3){
routerName = 'HouseDetail3';
}else{
}
this.$router.push({
name : routerName,
params: {
'info': rowData.id
}
})
}, 阅读更多
vue带有参数的路由跳转:
1. 接收路由传递的参数有两种方式; (this.$router.history.current.params 、 this.$route.params)
2. 为避免在跳转页面F5数据丢失,需要将传递的参数存到sessionStorage
3. 跳转的地方,路由跳转时, 不可使用 path, 要使用name。 (path适用于不带参数的跳转)
created(){
let info = this.$router.history.current.params.info;
// let info = this.$route.params.info;
if (info) {
sessionStorage.setItem("detailItem12", info);
}
let houseId = sessionStorage.getItem("detailItem12") + '';
this.houseId = houseId;
},
gotoDetailPage: function (index, rowData) {
let routerName = '';
if (rowData.houseLivedState == 1) {
routerName = 'HouseDetail1';
}else if(rowData.houseLivedState == 2){
routerName = 'HouseDetail2';
}else if(rowData.houseLivedState == 3){
routerName = 'HouseDetail3';
}else{
}
this.$router.push({
name : routerName,
params: {
'info': rowData.id
}
})
}, 阅读更多
相关文章推荐
- vue 路由跳转取不到params参数
- vue2.0 点击跳转传参--vue路由跳转传参数
- vue-cli 配置路由之间跳转传递参数
- vue 路由 及 跳转传递参数的总结
- vue-cli 配置路由>>跳转传递参数
- vue路由带参跳转,刷新后参数不消失
- vue路由跳转传参数demo
- vue通过 vue.mixin(混合)实现 任意页面记录滚动条位置(路由router.query参数一致) 并跳转到上次的位置
- vue路由跳转传参数
- vue-11-路由嵌套-参数传递-路由高亮
- Vue路由跳转问题记录详解
- ReactJs Router 路由地址跳转方式带参数
- 小程序中webview链接跳转?参数中带有多个参数的的问题
- 一个vue路由参数传递的注意点
- Vue 路由跳转方式 和 路由跳转时传参
- 微信小程序详解——页面之间的跳转方式【路由】和参数传递
- 详解vue嵌套路由-query传递参数
- 前端框架Vue(2)——Vue-Router 路由跳转
- vue基础教程(四) - 路由的配置、跳转、传参、嵌套
- 【Vue】3.vue2.0嵌套路由-params传递参数