ミニプログラムはマップインターフェースを呼び出します

wxmlコード:

<view class="location-box1">
    <image src="../../images/tabBar/location_on.png" bindtap="go"></image>
</view>

jsコード:

 

/**
 *在page对象前引入文件
 */
var QQMapWX = require('../../wxParse/qqmap-wx-jssdk.js');
var qqmapsdk ;

/**
 * 点击定位图标
 */
go(){
  let _this = this;
  wx.getLocation({//获取当前经纬度
  type: 'gcj02', //返回可以用于wx.openLocation的经纬度,官方提示bug: iOS 6.3.30 type 参数不生效,只会返回 wgs84 类型的坐标信息  
  success: function (res) {
    wx.openLocation({//​使用微信内置地图查看位置。
      latitude: 2*.****97,//要去的纬度-地址
      longitude: 11*.****87,//要去的经度-地址
      name: "天河",
      address:"天河详细地址",
    })
   }
 })
},

 

おすすめ

転載: blog.csdn.net/weixin_43452467/article/details/109160939