页面跳转传值:

1. 使用<router-link :to="'/saas-client/detail/'+scope.row.id"> 标签

在router.js中的path写法:path: 'detail/:id',
目标页面取值:this.companyId = this.$route.params.id;

2.使用:name – params传参数 - 地址栏看不到参数
this.$router.push({
        name:'saas-client-detail',
        params:{id:row.id}
      })

在router.js中的path写法:path: 'detail',
目标页面取值:this.companyId = this.$route.params.id;

3.使用:path – query 传参 - 地址栏可以看到参数
this.$router.push({
        path:'/saas-client/detail',
        query:{id:row.id}
      })

目标页面取值:this.companyId = this.$route.query.id

获取路径中的参数的两种形式
  1. 路径:http://localhost:3000/edit/123
    取值123的方式:this.$route.params.id

  2. 路径:http://localhost:3000/?token=123
    取值123的方式:this.$route.query.token

Logo

前往低代码交流专区

更多推荐