vue A页面向B页面传值,地址栏可以不进行显示的问题

参考: https://blog.csdn.net/weixin_43836052/article/details/95166345

页面A 向 页面B 进行传值,分两种情况

1.params 传参 : 相当于post请求,跳转时参数不会在地址栏中显示

    ``` html  

            this.$router.push({
               name:'B页面名称',
               params: {id:params}
            })

            接收参数:this.$route.params.id  

     ``` html
         

2.query 传参 : 相当于get请求,页面跳转时参数会在地址栏中显示

    ``` html  
           this.$router.push({
               name:'B页面名称',
               query: { id:params }
            })
    接收参数:this.$route.query.id

     ``` html

猜你喜欢

转载自www.cnblogs.com/zongheng14/p/11606324.html