在显示地图的时候有时候,为什么有时候失败,地图设置有大小,就是不知为什么,总有那么一两次时候地图显示不出来,这是什么原因,怎么处理

用户距离您30米
- 发布:2019-03-01 14:41
- 更新:2019-03-01 14:45
- 阅读:672
地图显示失败
分类:uni-app
2 个回复
用户距离您30米 (作者) - 98IT
动态赋值的时候会出现渲染慢,延迟执行都没效果
用户距离您30米 (作者) - 98IT
代码大致是这样的:<map :style="{height:screenHeight+'px',width:screenWidth+'px'}"></map>
data() {
return {
screenWidth: '390',
screenHeight: '580'
}
}
js:获取手机屏幕高宽,动态赋值
var that = this;
console.log(this.screenWidth)
console.log(this.screenHeight)
uni.getSystemInfo({
success: function(res) {
that.screenWidth = res.windowWidth;
that.screenHeight = res.windowHeight - 56;
},
});
请问为什么有时候失败