window.ajaxGet = function (that, myUrl, data, callback) {       //创建一个ajax get请求
  that.$http.get(url + myUrl, { params: data, headers: headers }).then(response => {          //用于读取类型与请求方式
    if (typeof (response) != "undefined") {
      callback(response);
    }
  });
}
          let Myurl="/api/Company";
          let that=this;
          let data= {
            Index:(val-1)
          };
          ajaxGet(that,Myurl,data,function(r){
            that.data=r.data.Data.Rows;
          });

//callback 返回

window.ajaxPost = function (that, myUrl, data, callback) {      //创建一个ajax 请求
  that.$http.post(url + myUrl,stringify(data),{headers: headers}).then(response => {
    if (typeof (response) != "undefined") {
      callback(response);
    } 
  });
}

//post同理

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐