vue实现跨页面传递参数

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_29918313/article/details/82862548

A页面带着参数传给B页面,B页面带着该参数请求接口或者有其他用途

A页面:

/* 编辑 */
    handleEdit (aa) {
      let params = {
        aaId: aa.aaId
      }
      this.$router.push({
        path: '/bb/edit',
        name: 'Edit',
        params: params
      })
    },

B页面:

首先要接收A页面传递过来的参数:

let aaId = this.$route.params.aaId

接收方式就是代码中使用的this.$route.params.aaId。B页面中需要带着aaId请求数据,则直接使用即可。另外,跳转页面使用this.$router.push({})。

猜你喜欢

转载自blog.csdn.net/qq_29918313/article/details/82862548