1、替代本窗口,不传参数
$router.push('/details')
2、替代本窗口,传参
this.$router.push({name:'anotherPage',params:{id:1}}); //方法1
this.$router.push({path:'/anotherPage',query:{id:1}}); //方法2 传递查询参数 在地址中展示
页面接收参数:
this.$route.params.id; //方法1
this.$route.query.id; //方法2
3、打开新窗口,传参
let routeData = this.$router.resolve({ path: '/home', query: { id: 1 } });
window.open(routeData.href, '_blank');
页面接收参数:
this.$route.query; // .addflg
如果单独加载这个列表,this.$route.query.addflg 会报错,那么就做个判断:
var t=this.$route.query ? this.$route.query : '',
如果要跳转到其他列表对应的弹框 可以直接 跳的对应的列表页面, 判断 直接调用对应的方法
如果跳转后页面地址多出了http:xxxx(baseurl)地址,可以在router/index.js中去除base: 'xxxx';这行代码