Skip to content

Commit a269cff

Browse files
[fix]es6 ?.语法去掉
1 parent d5fa1e8 commit a269cff

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/common/mapping/WebMapV2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo, crsMa
189189
if (popupInfo){
190190
let elements = popupInfo.elements || [];
191191
if (fieldCaptions) {
192-
elements = popupInfo.elements?.map(item=>{
192+
elements = (popupInfo.elements || []).map(item => {
193193
if (item.type === 'FIELD') {
194194
item.fieldCaption = fieldCaptions[item.fieldName] || item.fieldName;
195195
}

src/common/mapping/WebMapV3.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,11 @@ export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsMa
339339
const { datas = [] } = this._mapResourceInfo;
340340
let fieldCaptions = null;
341341
datas.forEach(data => {
342-
const index = data.datasets?.findIndex(dataset => dataset.msDatasetId === msDatasetId);
343-
if (index !== -1) {
344-
fieldCaptions = data.datasets[index].fieldsCaptions;
342+
if (data.datasets) {
343+
const index = data.datasets.findIndex(dataset => dataset.msDatasetId === msDatasetId);
344+
if (index !== -1) {
345+
fieldCaptions = data.datasets[index].fieldsCaptions;
346+
}
345347
}
346348
});
347349
return fieldCaptions;
@@ -353,12 +355,12 @@ export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsMa
353355
if (popupInfo) {
354356
const fieldCaptions = this._getFieldCaption(msDatasetId);
355357
if (fieldCaptions) {
356-
popupInfo.elements = popupInfo.elements?.map(item=>{
358+
popupInfo.elements = popupInfo.elements ? popupInfo.elements.map(item => {
357359
if (item.type === 'FIELD') {
358360
item.fieldCaption = fieldCaptions[item.fieldName] || item.fieldName;
359361
}
360362
return item;
361-
});
363+
}) : [];
362364
}
363365
popupInfo.id = id;
364366
return popupInfo

0 commit comments

Comments
 (0)