最近在学习微信小程序云开发,刚一开始就遇到了问题. 点击获取openid的时候控制台开始报错: [云函数] [login] user openid: undefined VM97:1 Setting data field "openid" to undefined is invalid. 然后我开始去百度搜索解决这个问题,各种方法都试过了,还是没有解决.换了一个思路,开始追踪代码: 鼠标悬停到右边的 index.js:55,发现是/pages/index/index.js文件的第55
要求要完成的功能: 1.要完成的要点是城市定位. 2.就是切换城市. 首页我们先参照微信小程序开放的官方文档找到: 在这里我们可以找到”当前位置经纬度“ getLocation: function () { var that = this wx.getLocation( { success: function (res) { console.log(res) that.setData({ hasLocation: true, location: formatLocation(res.longit