郑州建网站的_注册界面背景图片_近三个月的时政热点_邵阳县小程序app网站开发
Page({data: {latitude: 0,longitude: 0,destinationName: ''},onLoad: function () {this.getLocation();},getLocation: function () {wx.getLocation({type: 'wgs84',success: res => {this.setData({latitude: res.latitude,longitude: res.longitude});this.getAddressInfo(res.latitude, res.longitude);},fail: err => {console.error('获取位置失败', err);}});},navigateToMap: function () {wx.openLocation({latitude: this.data.latitude,longitude: this.data.longitude,scale: 18,name: this.data.destinationName,address: this.data.locationAddress,success: res => {console.log('成功打开地图', res);},fail: err => {console.error('打开地图失败', err);}});},getAddressInfo: function (latitude, longitude) {wx.request({url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${latitude},${longitude}&key=YOUR_API_KEY`,success: res => {const address = res.data.result.address;this.setData({locationAddress: address,destinationName: res.data.result.title});},fail: err => {console.error('地址解析失败', err);}});}">