前端函数调用API函数

应用场景


简单的前端调后台,实现增删查改操作

API函数示例

let AbstractAPIHandler = require('AbstractAPIHandler');

class MyAPIHandler extends AbstractAPIHandler {

  execute(request){
    var r = request.r;
    return {apidata: 3*r};
  }
}
exports({"entryPoint":MyAPIHandler});

前端函数示例

function (event) {

  var viewModel = this;
    //cb.rest.invokeFunction("后端函数id","传参","回调处理")
  cb.rest.invokeFunction("7f4237efde03414aaf80b8aa4b5e8ef8", {r:2},

  function(err, res) {

    console.log(err);

    console.log(res);

  });

}

后端函数id怎么获取?

图 1

图 2

Copyright © 用友客户成功部 2020 all right reserved,powered by Gitbook修订时间: 2020-09-09 13:10:43

results matching ""

    No results matching ""