// succ.wxml <view>經度:{{lon}}</view> <view>緯度:{{lat}}</view> // succ.js var app = getApp() Page({ data: { lon: '', // 經度 lat: '', // 緯度 }, onLoad: function (e) { // 獲取參數 var that = this; wx.getLocation( { success: function (res) { that.setData({ hasLocation: true, lon: res.longitude, lat:res.latitude//這里是獲取經緯度 }) } }) } })
