//onReady() {
// let that = this;
// this.mapContext = uni.createMapContext("alarm_map", this);
// // 点聚合的初始化配置
// this.mapContext.initMarkerCluster({
// enableDefaultStyle: false, // 是否启用默认的聚合样式(是否用自定义图标)
// zoomOnClick: false,//点击已经聚合的标记点时是否实现聚合分离
// gridSize: 60,//聚合算法的可聚合距离,即距离小于该值的点会聚合至一起,以像素为单位
// complete(res) {
// }
// });
// // 3.发生聚合时,给聚合点设置marker标签
// that.mapContext.on('markerClusterCreate', res => {
// let clusters = res.clusters // 新产生的聚合簇
// let zhou = clusters.map(item=> {
// let {
// center, // 聚合点的经纬度数组
// clusterId, // 聚合簇id
// markerIds // 已经聚合了的标记点id数组
// } = item
// return {
// ...center,
// width: 49,
// height: 60,
// joinCluster:false,
// clusterId:Number(clusterId), // 必须有
// iconPath: '/appmanage/icon2.png',
// label: { // 定制聚合点样式
// content: String(markerIds.length),
// fontSize: 20,
// width: 42,
// height: 42,
// color: '#000',
// bgColor: '#A2FF1C',
// borderRadius: 23,
// textAlign: 'center',
// anchorX: Number((that.platform=='ios'?0:-21)),
// anchorY: -56
// }
// }
// })
// // 4. 添加聚合簇标签
// that.mapContext.addMarkers({
// markers: zhou,
// clear: false //是否先清空地图上所有的marker
// })
// })
// //监听聚合点的点击
// that.mapContext.on('markerClusterClick', (result) => {
// let userList = [];
// result.markerIds.map(item=>{
// userList.push(that.list[item]);
// })
// that.userList = userList;
// that.userShow = true;
// that.$refs.userPopup.open("center");
// });
//},
0 个回复