uni-app nvue页面高德<map>组件缩放拖拽时闪退 Android卡顿 @regionchange高频触发请求
uni-app nvue页面高德<map>组件缩放拖拽时闪退 Android卡顿 @regionchange高频触发请求
信息类别 | 详情 |
---|---|
产品分类 | uniapp/App |
PC开发环境操作系统 | Windows |
PC开发环境操作系统版本号 | Windows 11 专业版 |
HBuilderX类型 | 正式 |
HBuilderX版本号 | 4.07 |
手机系统 | 全部 |
手机厂商 | 苹果 |
页面类型 | vue |
vue版本 | vue2 |
打包方式 | 云端 |
项目创建方式 | HBuilderX |
测试过的手机
- iphone13
- 红米手机
示例代码
<map :latitude="latitude" :longitude="longitude" :polygons='polygons' :markers='covers' style="width: 750rpx"
style="{height:mapHeight+'px'}" id="myMap" :scale="searcHouseParam.scale" @markertap="calloutTap"
@callouttap='calloutTap' [@regionchange](/user/regionchange)='intervalFn' :show-location='false'></map>
关键方法
intervalFn(e) {
let types = plus.os.name.toLowerCase() == 'ios' ? e.detail.type : e.type;
if (types != 'end') {
return
};
uni.$u.debounce(() => {
console.log(types, 'types');
let that = this
this.mapContext.getScale({
success: (res) => {
this.searcHouseParam.scale = res.scale;
this.mapContext.getCenterLocation({ //获取中心坐标来获取对应的mark点
success: suc => {
that.longitude = suc.longitude;
that.latitude = suc.latitude;
that.mapContext.getRegion({
success: res => {
that.searcHouseParam.northeast =
res.northeast.longitude + ',' +
res.northeast.latitude;
that.searcHouseParam.southwest =
res.southwest.longitude + ',' +
res.southwest.latitude;
try {
if (that.tree == 4) {
that.getHouseList(1, 20)
} else {
that.getHouseList(1)
}
} catch (e) {
//TODO handle the exception
}
}
})
})
});
if (res.scale > 10 && this.treeType == 1) {
this.treeType = 2;
}
if (res.scale <= 10) { //区域级
this.searcHouseParam.selectedAreaId = '';
this.searcHouseParam.selectedPlateId = [];
this.searcHouseParam.selectedEstateId = null;
if (this.tree == 1) {
this.polygons = null;
} else {
this.treeType = 1
this.tree = 1
}
} else if (res.scale > 10 && res.scale <= 14) { //板块级
this.searcHouseParam.selectedPlateId = [];
this.searcHouseParam.selectedEstateId = null;
if (this.tree == 2) {}
else {
this.tree = 2
}
} else if (res.scale > 14 && res.scale <= 16) { //小区级
this.searcHouseParam.selectedEstateId = null;
if (this.tree == 3) {}
else {
this.tree = 3
}
} else if (res.scale > 16 && res.scale <= 28) { //房源级
if (this.tree == 4) {}
else {
this.treeType = 4
this.tree = 4
}
};
}
)
}, 1200)
},
操作步骤
- 进入页面—缩放,拖拽地图,点击气泡
预期结果
- 点击气泡:中心点移动到被点击的气泡,拖拽:展示视野范围内气泡,缩放:展示视野范围内气泡
实际结果
- 闪退,卡顿
bug描述
nvue页面高德<map> 缩放 拖拽会 闪退 Android会卡顿,@regionchange会触发多次导致高频触发请求
更多关于uni-app nvue页面高德<map>组件缩放拖拽时闪退 Android卡顿 @regionchange高频触发请求的实战教程也可以访问 https://www.itying.com/category-93-b0.html