微信小程序request怎么添加token

getMenuInfo(){

wx.request({
  url: 'https://appdb.hsltm.com/wxapi-web/indexPageDiaryCategory',
  data: {},
  method: 'get',
  header: {
    'content-type': 'application/json'
  },
  success: function (res) {
    if (res.data == 0) {
        console.log(res)
    }
  }
})

},

阅读 8.2k
2 个回答

header: {

    'content-type': methods == 'GET' ? 'application/json' : 'application/x-www-form-urlencoded',
    'Authorization': 'xxxx'
  },

可以写在header里面作为一个字段

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题