向接口传值的几种方式和页面之间传值的方式的简单记录

  接口传值:

  1. 就是直接在接口后面像字符串连接一样就可以完成传值了  's/a/t/a?p=' + that.p + '&money=' + that.money + '&Id=' + that.Id
  2. 以对象的形式进行
 var requestData = {
        page: 1,
        size: 10,
        userId: this.Id
    }
requestData = JSON.stringify(requestData);

随便写的一个接口:'s/l/w/r','POST',requestData,

 

  页面传值

  1. 可以在点击页面跳转时,在页面路径上进行带值传递到另一个页面
  2. 在另外一个页面接收所传的参数
@click.stop="goToViewSave('./withdrawalRecord/withdrawalRecord?Id='+Id+'&money='+money)"

  

onLoad(option) {
        this.Id = option.Id        // 从页面传过来的Id
        this.money = option.money    // 页面传过来的money
     console.log('money:',this.money)  // 可以进行打印到控制台,进行查看,值是否传递过来了
},

 

posted @ 2021-04-30 11:08  温柔本肉  阅读(621)  评论(0编辑  收藏  举报