今天微信小程序发现wx.request不好使了,调试报错: 小程序要求的 TLS 版本必须大于等于 1.2 查官方文档 解决方法 在 PowerShell中运行以下内容, 然后重启服务器 # Enables TLS 1.2 on windows Server 2008 R2 and Windows 7 # These keys do not exist so they need to be created prior to setting values. md "HKLM:\SYSTEM\Cur…
在调取地图的时候发现,wx.openLocation的方法在模拟器和安卓手机上都可以用,在苹果手机上报错. 报错为调取失败:fail invoke too frequently fail invalid_coordinate 解决方法: 微信小程序默认将组件上绑定的参数都当作字符串了,所以认为坐标点不正确,强制转换成number类型即可. var lat = Number(e.currentTarget.dataset.lat), lng =…
首先,在page外定义一个函数用户判断是否为空对象 var isEmptyObject = function (e) { var temp; for (temp in e) ; } 然后,在page中的onload里面调用授权 onLoad: function () { var that = this; if (app.globalData.userInfo) { this.setData({ userInfo: app.globalData.userInfo }) } else if (thi…
首先,在page外定义一个公共函数用于发送获取位置的请求 var getLocation = function (that) { wx.getLocation({ type: 'wgs84', success: function (res) { // 经纬度 var latitude = res.latitude var longitude = res.longitude var aK = that.data.aK wx.request({ url: 'https://api.map.baidu…
第一个页面: go_pick_time:function(e){ var that = this; var type = e.currentTarget.dataset.type; wx.navigateTo({ url : '/pages/record/picktime?type=' + type }); }, onShow: function () { var that = this; console.log(that.data); // 这里就可以抓取到设置的值 let { on_type…