if (passType === 9 && this.passType9Triggered === false) { uni.showModal({ success: (res) => { var markers = [ { id: 20, branch: 9, latitude: 30.570861, longitude: 114.350871, iconPath: iconPathValue, width: 32,height: 32, title: '20',callout: { content: '标记20' },clickable: true, weight: 0 }, { id: 21, branch: 10, latitude: 30.572043, longitude: 114.348478, iconPath: iconPathValue, width: 32,height: 32, title: '21',callout: { content: '标记21' },clickable: true, weight: 0 },];},})} uniapp中,如何令id: 20所在的点位图标无法响应 @markertap="onMarkerTap"
时间: 2024-02-07 21:02:15 浏览: 74
你可以通过设置 `clickable` 属性为 `false` 来使得该点位图标无法响应 `@markertap` 事件。具体来说,可以将 `clickable: true` 改为 `clickable: false`,如下所示:
```
var markers = [
{
id: 20,
branch: 9,
latitude: 30.570861,
longitude: 114.350871,
iconPath: iconPathValue,
width: 32,
height: 32,
title: '20',
callout: { content: '标记20' },
clickable: false, // 设置为 false
weight: 0
},
{
id: 21,
branch: 10,
latitude: 30.572043,
longitude: 114.348478,
iconPath: iconPathValue,
width: 32,
height: 32,
title: '21',
callout: { content: '标记21' },
clickable: true,
weight: 0
}
];
```
这样,当 `passType` 为 9 且 `passType9Triggered` 为 `false` 时,弹出的模态框中的 `id` 为 20 的点位图标就无法响应 `@markertap` 事件了。
阅读全文