map设置了中心点的坐标,但是真机上视觉上不居中?
发布于 6 年前 作者 tpeng 11344 次浏览 来自 官方Issues

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/[email protected]”,

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 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部