请求方式总结

一、微信小程序

wx.request({
  method:'POST',
  url: 'http://jdfshgsgerkkp', //仅为示例,接口地址
  data: {
    x: '',
    y: ''
  },
  header: {
    'content-type': 'application/json' // 默认值
  },
  success (res) {
    console.log(res.data)
  }
})

二、ajax

$.ajax({
    type: "POST", //请求方式
    url: "../user/selectById", //请求接口
    data: decodePass,   // dataType: 'JSON',
    contentType: 'application/json;charset=utf-8',
    async: false, //异步
    success: function(res) {
    }
});

三、vue

  this.$axios({
    method: "post",
    url: this.HOST + "/systemAdmin/update",
    data: this.roleform[0]
  }).then(res => {
 
  });

  this.$axios.post(url, this.data).then(res => {
  }
发布了17 篇原创文章 · 获赞 1 · 访问量 2738

猜你喜欢

转载自blog.csdn.net/qq_42014265/article/details/95042805