diff --git a/src/mapboxgl/web-map/WebMapV2.ts b/src/mapboxgl/web-map/WebMapV2.ts index bc39871f..fa0fc316 100644 --- a/src/mapboxgl/web-map/WebMapV2.ts +++ b/src/mapboxgl/web-map/WebMapV2.ts @@ -1566,6 +1566,9 @@ export default class WebMap extends WebMapBase { for (const key in expressionMap) { if (Object.prototype.hasOwnProperty.call(expressionMap, key)) { const expression = expressionMap[key]; + if (!Array.isArray(expression)) { + continue; + } const defaultStyleItem = defultLayerStyle[key] || defaultValueFactory[key]; const styleItem = { [key]: defaultStyleItem }; // 从customsetting里取了透明度和color一起处理了,layerinfo.style里的透明度就不需要了 diff --git a/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js b/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js index 218f6801..025e6070 100644 --- a/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js +++ b/src/mapboxgl/web-map/__tests__/WebMapViewModel.spec.js @@ -308,7 +308,7 @@ describe('WebMapViewModel.spec', () => { expect(item.renderLayers.length).toBeGreaterThanOrEqual(1); }) expect(viewModel.map.getStyle().layers.find((item)=>{return item.type === 'fill'}).paint['fill-opacity']).toBe(1); - expect(viewModel.map.getStyle().layers.find((item)=>{return item.type === 'fill'}).paint['fill-color'][3]).toBe('rgba(213, 62, 79, 0.9)'); + expect(viewModel.map.getStyle().layers.find((item)=>{return item.type === 'fill'}).paint['fill-color'][3]).toBe('rgba(230, 245, 153, 0.7)'); done(); }; viewModel.on({ addlayerssucceeded: callback }); diff --git a/test/unit/mocks/data/WebMap/uniqueLayer_polygon.json b/test/unit/mocks/data/WebMap/uniqueLayer_polygon.json index fdafd574..e080098a 100644 --- a/test/unit/mocks/data/WebMap/uniqueLayer_polygon.json +++ b/test/unit/mocks/data/WebMap/uniqueLayer_polygon.json @@ -15,12 +15,12 @@ "layerType": "UNIQUE", "visible": true, "themeSetting": { - "themeField": "行政区划_c", + "themeField": "机场", "customSettings": { - "四川省": { + "北京/首都": { "strokeWidth": 1, "fillColor": "#e6f599", - "fillOpacity": 0.9, + "fillOpacity": 0.7, "lineDash": "solid", "strokeColor": "#ffffff", "type": "POLYGON",