請求方式總結

一、微信小程序

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) {
    }
});

三、axios

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

  this.$axios.post(url, this.data).then(res => {
  }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章