Android定时刷新marker,【报Bug】map markers在Android手机上大于133个点不能清空刷新&markertap事件也失效...

uni.request({

url: getApp().globalData.url + '/admin/iot/device/status/list',

method: 'POST',

data: {},

header: {

"Accept": "application/json",

// "Content-Type": "application/json;charset=UTF-8",

"Content-Type": "application/x-www-form-urlencoded;charset=utf-8",

"authorization": getApp().globalData.authorization

},

//成功

success: (res) => {

console.log("markers==", res.data.data[0])

let arr = res.data.data;

let markers = [];

let obj = '';

this.latitude = arr[0].lat;

this.longitude = arr[0].lng;

let lvl_first = false;

for (let i = 0; i < arr.length; i++) { //最多133个点 再多点击事件就没了

// for (let i = 0; i < 133; i++) { //最多133个点 再多点击事件就没了

//

obj = {

latitude: arr[i].lat,

longitude: arr[i].lng,

iconPath: '../../../static/logo.png',

id: arr[i].id + "",

width: 30,

height: 30,

// callout: {

// //自定义标记点上方的气泡窗口 点击有效

// content: 'ID:',

// color: '#F76350',

// fontSize: 15,

// borderRadius: 5

// }

}

if (arr[i].alarmName) {

switch (arr[i].alarmName) {

case "Level 2":

obj.iconPath = '../../../static/icon_yellow.png'

break;

case "Level 1":

obj.width = 35;

obj.height = 35;

// console.log("=====", arr[i].alarmName)

obj.iconPath = '../../../static/icon_red.png'

if (!lvl_first) {

lvl_first = true;

if (!this.searchStr) {

this.latitude = arr[i].lat;

this.longitude = arr[i].lng;

}

this.vibrate();

}

plus.push.createMessage("111111", "sseeee", {

title: "222",

id: "123456"

})

break;

default:

obj.iconPath = '../../../static/icon_gray.png'

break;

}

} else {

obj.iconPath = '../../../static/icon_gray.png'

}

markers.push(obj)

}

this.covers = markers;

console.log("covers==", this.covers.length)

},

fail: (res) => {

console.log("失败:", res);

}

})

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值