微信api接口详解

发起请求  wx.request
wx.request({
  url: 'test.php', //仅为示例,并非真实的接口地址
  data: {
     x: '' ,
     y: ''
  },
  header: {
      'content-type': 'application/json' // 默认值
  },
  success: function(res) {
    console.log(res.data)
  }
})

url  写跳转的地址  data 是传输的数据  success 成功之后 进行细操作

数据缓存 wx.setStorage()

wx.setStorage({
  key:"key",
  data:"value"
})

key  是 文件名

data 是数据

缓存读取 wx.getStoragesync()

括号内 写缓存是的文件名 传给变量即可


猜你喜欢

转载自blog.csdn.net/woshigemengxin/article/details/80190008