收藏
回答

求解,为什么地图不显示了,不知道自己哪儿修改出bug了

<map id="Map" longitude="{{longitude}}" latitude="{{latitude}}" scale="14" class='map'  controls="{{controls}}" bindcontroltap="controltap"></map>
var Bmob = require('../../utils/bmob.js');
var app = getApp();
Page({
  data: {
    longitude: "",
    latitude: "",
    controls: [{
        iconPath: '/images/address.png',
        position: {
          left: (app.globalData.windowWidth / 2) - 20,
          top: (app.globalData.windowHeight - 40) / 2 - 38,
          width: 40,
          height: 40
        }
      },
      {
        id: 1,
        iconPath: '/images/positioning.png',
        position: {
          left: 20,
          top: 20,
          width: 40,
          height: 40
        },
        clickable: true
      }
    ]
  },
  staticData: {
    latitude: "",
    longitude: ""
  },
 
  onShow() {
    this.getLocation();
  },
  onReady: function(e) {
    var that = this;
    this.mapCtx = wx.createMapContext('Map')
  },
 
  getLocation(e) {
    var that = this;
    wx.getLocation({
      type: 'gcj02 ',
      success(res) {
        that.staticData.longitude = res.longitude,
          that.staticData.latitude = res.latitude
 
 
      }
    })
  },
  controltap() {
    this.mapCtx.moveToLocation()
  },
 
 
  onShareAppMessage() {
    return {
      title: '萌宠交易平台',
      path: '/page/index/index'
    }
  }
 
});


回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容