收藏
回答

map设置了中心点的坐标,但是真机上视觉上不居中?

onLoad: function (options) {

//地图

var that = this;

// unlogin =

console.log('授权电话号码有没有')

// console.log(wx.getStorageSync('phonenumber').length)

console.log(wx.getStorageSync('phonenumber'))

// console.log(app.globalData.userInfo.unlogin)

if (app.globalData.userInfo.unlogin && app.globalData.userInfo.unlogin == 1 ){

console.log('11111');

that.setData({

unlogin: true

})

}

if (wx.getStorageSync('nickname') == '' && app.globalData.userInfo.unlogin != 1 ) {

wx.navigateTo({

url: '/pages/newnewindex/newnewindex'

})

}

wx.getStorage({

key: 'phonenumber',

success(res) {

if (res.data != "" && res.data != null)

that.setData({

phonenumber: res.data,

hasPhoneNumber: true

})

}

})

// var that = this

qqmapsdk = new QQMapWX({

key: 'UIVBZ-IGVWP-CSWDB-VILVI-ZVVQ7-2JBFG'

})

var markers = []

wx.request({

url: 'https://www.walnutbookstore.com:8003/store/get',

data: {},

method: 'POST',

success: function (res) {

for (var x = 0; x < res.data.length; x++) {

res.data[x].iconPath = '../../img/u98.png'

// res.data[x].iconPath = '../../img/lllo5.svg'

res.data[x].width = 32

res.data[x].height = 37

}

markers = res.data

console.log(markers)

wx.getLocation({

success: function (res) {

var longitude = res.longitude;

var latitude = res.latitude;

that.setData({

appmarkers: markers,

longitude: longitude,

// iconPath: "../images/imgs_main_bike@2x.png",

latitude: latitude,

'markers': markers,

mapScale: 15

//  mapScale: 15

})

console.log('longitude' + longitude);

console.log('latitude' + latitude);

// 查找单车信息

// findBikes(longitude, latitude, that);

},

});

},

fail: function (res) {

console.log("失败--------------")

console.log(res)

}

})

},

<map id="myMap" longitude="{{longitude}}" latitude="{{latitude}}" markers="{{markers}}" scale="{{mapScale}}" show-location bindregionchange="regionchange" bindmarkertap="showModal" controls="{{controls}}" bindcontroltap="controltap">

</map>


开发者工具:显示正常

真机iphonex:

安卓手机:


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

1 个回答

登录 后发表内容
问题标签