仓储网站开发,百度域名书写,网站建设中页面下载,织梦网站上传保存文档1、打开内置地图
wx.openLocation({latitude: 31.230416, // 上海的纬度longitude: 121.473701, // 上海的经度name: 上海市, // 地点名称address: 中国上海市黄浦区人民广场, // 地址的详细说明scale: 18, // 缩放比例success: function(res) {console.log(打开地图成功);},f…1、打开内置地图
wx.openLocation({latitude: 31.230416, // 上海的纬度longitude: 121.473701, // 上海的经度name: 上海市, // 地点名称address: 中国上海市黄浦区人民广场, // 地址的详细说明scale: 18, // 缩放比例success: function(res) {console.log(打开地图成功);},fail: function(err) {console.log(打开地图失败, err);}
});在地图上显示指定位置的标记点并且支持调用内置地图进行导航打开地图后点击右下角导航图标会弹出选项弹窗让用户选择使用哪一个地图应用程序进行导航
2、使用 map 组件
view bind:tapopenLocation打开导航/view
map idmap styledisplay:none/data: {mapCtx:null},onLoad(options) {this.data.mapCtx wx.createMapContext(map);},openLocation(){this.data.mapCtx.openMapApp({latitude: parseFloat(this.data.latitude),longitude: parseFloat(this.data.longitude),destination: this.data.name,fail(error) {if (!/cancel/i.test(error.errMsg)) {wx.showToast({title: error.errMsg,icon:none})} else {console.error(打开导航失败, error.errMsg);}},});},这个方式在真机上有效可以直接弹出一个弹窗选择app之后如果手机下载了则可以打开并跳转到对应app里面去没有下载则直接跳转到下载页