wx.getLocation({ type: 'wgs84', success: function (res) { alert("=======" + res.latitude); coords.latitude = res.latitude; // 緯度,浮點數,范圍為90 ~ -90 coords.longitude = res.longitude; // 經度,浮點數,范圍為180 ~ -180。 alert("com here===" + coords.longitude); getShopList(); }, cancel: function (res) { getShopList(); }, fail: function (res) { getShopList(); } }); 上面是我寫的調用方法,能進success方法,并且執行了第一個alert,但是下面的不能執行了。我懷疑是js不識別coords和getShopList方法,這我都在外層定義的,我懷疑是作用域的問題。但是不知道怎么解決
wx.getLocation無法正確執行回調,估計是作用域的原因
慕無忌1623718
2018-10-18 14:41:57