1.小程序中使用map组件map | 微信开放文档

<map @click="goMap" style="width: 690rpx; height: 170rpx;" :latitude="info.latitude"
:longitude="info.longitude" :markers="markers" :enable-poi="true"
subkey='7SQBZ-3GDCI-RTUGE-5FOI7-B7GEV-I4FSB' layer-style='4' scale="15"></map>

2.使用微信内置地图查看位置wx.openLocation,这一步便是打开地图软件的关键

官文地址:wx.openLocation(Object object) | 微信开放文档

写完下面方法即可调起选择地图软件弹窗了

goMap() {
	wx.openLocation({
		latitude: Number(this.info.latitude),
		longitude: Number(this.info.longitude),
		name: this.info.title,
		address: this.info.province_name + this.info.city_name +           this.info.area_name + this.info.address,
		scale: 28
	})
},

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐