vue跨页面传参

例:登录页和首页

登录页点击登录跳转到首页的时候,添加该参数:

this.$router.replace({ path: '/Testing' ,query:{id:'1',name:this.ruleForm2.account}});

 

 

 然后在首页获取参数:

export default {
		created() {
			console.log(this.$route.query.name);
			this.sysUserName = this.$route.query.name
		},
		data() {}
}

成品:

  

 

不过这种有个缺点,就是参数在url上!

 

posted @ 2020-04-27 20:07  小蘑菇123  阅读(534)  评论(0)    收藏  举报