常规小优化
This commit is contained in:
@ -79,16 +79,17 @@ export default {
|
||||
this.latitude = lat;
|
||||
this.longitude = lng;
|
||||
// 创建标记点
|
||||
console.log("devicePic=",marker)
|
||||
this.covers = [{
|
||||
id: marker.deviceImei, // 适配deviceId字段
|
||||
latitude: lat,
|
||||
longitude: lng,
|
||||
iconPath: marker.devicePic || '/static/images/common/mapLocation.png',
|
||||
width: 40,
|
||||
height: 40,
|
||||
iconPath: '/static/images/common/mapLocation.png',
|
||||
width: 60,
|
||||
height: 60,
|
||||
anchor: {x: 0.5, y: 0.5}, // 锚点在中心
|
||||
callout: {
|
||||
content: `ID: ${marker.deviceImei}`
|
||||
content: `${marker.deviceName}`
|
||||
}
|
||||
}];
|
||||
|
||||
@ -102,17 +103,18 @@ export default {
|
||||
this.latitude = parseFloat(firstMarker.latitude);
|
||||
this.longitude = parseFloat(firstMarker.longitude);
|
||||
|
||||
console.log("devicePic=",marker.devicePic)
|
||||
// 转换所有有效标记点
|
||||
this.covers = markers.map((marker, index) => ({
|
||||
id: marker.deviceId || marker.id || marker.deviceImei || index + 1,
|
||||
latitude: parseFloat(marker.latitude),
|
||||
longitude: parseFloat(marker.longitude),
|
||||
iconPath: marker.devicePic || '/static/images/common/device.png',
|
||||
width: 40,
|
||||
height: 40,
|
||||
iconPath: '/static/images/common/mapLocation.png',
|
||||
width: 60,
|
||||
height: 60,
|
||||
anchor: {x: 0.5, y: 0.5},
|
||||
callout: {
|
||||
content: `ID: ${marker.deviceImei}`,
|
||||
content: `${marker.deviceName}`,
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user