收藏
回答

MapContext.addGroundOverlay 添加两个图层后 ,IOS 丢失图层?

Page({
    /**
     * 页面的初始数据
     */
    data: {
        longitude:117.380771,
        latitude:37.814422,
        markers: [{
        }]
 
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function () {
      this.mapCtx = wx.createMapContext('mapId')
      // 自定义背景
      this.mapCtx.addGroundOverlay(
        {
          id: 1,
          src: "../images/home/map-3.png",
          bounds: {
            northeast: { //东北角
                latitude: 37.819788,
                longitude: 117.383956,
              },
            southwest: { //西南角 
              latitude: 37.809342,
              longitude: 117.377628,
            },
          },
          visible: true,
          zIndex: 1, 
          success(res){
            console.log('wp', res)
          },
          fail(err){
            console.log('wperr', err)
          }
        } 
      )
      // 四合院
      this.mapCtx.addGroundOverlay({
        id: 2,
        src: "../images/guide/icon-siheyuan.png",
        bounds: {
          northeast: { //东北角 
            latitude: 37.817685,
            longitude: 117.379101,
          },
          southwest: { //西南角 
            latitude: 37.817167,
            longitude: 117.378499,
          }
        },
        visible: true,
        zIndex: 2,
        success(res) {
            console.log('wp2', res.errMsg)
          },
          fail(error) {
            console.log('wp2', res.errMsg)
          },
          complete(res) {
            console.log(res);
          },
      })
      
    },
   })
回答关注问题邀请回答
收藏

1 个回答

  • Demons
    Demons
    2023-08-22

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2023-08-22
    有用
    回复
登录 后发表内容