Skip to content

Commit 66a5e9e

Browse files
committed
【feature】webmap mapId 传json 优化
1 parent 6dc64dd commit 66a5e9e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/common/mapping/WebMap.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
this.webMapInfo = null;
323323
} else if (mapId !== null && typeof mapId === 'object') {
324324
this.webMapInfo = mapId;
325+
this.mapId = '';
325326
}
326327
this.webMapService.setMapId(mapId);
327328
if (!mapId) {
@@ -406,8 +407,8 @@
406407
* @private
407408
*/
408409
const WebMapFactory = this._createWebMapFactory(type);
409-
this._handler = new WebMapFactory(this.mapId, commonOptions, mapOptions);
410-
// this._handler.setEventedParent(this);
410+
const mapId = this.mapId || this.webMapInfo;
411+
this._handler = new WebMapFactory(mapId, commonOptions, mapOptions);
411412
for (const type in commonEvents) {
412413
this._handler.on(type, commonEvents[type]);
413414
}

test/common/mapping/WebMapBaseSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ describe('WebMapBaseSpec.js', () => {
355355
webMapBase.setMapId(mapId);
356356
jasmine.clock().tick(10);
357357
expect(spy.calls.count()).toBe(1);
358-
expect(webMapBase.mapId).toBe(id);
358+
expect(webMapBase.mapId).toBe('');
359359
expect(webMapBase.webMapInfo).toEqual(mapId);
360360
jasmine.clock().uninstall();
361361
done();

0 commit comments

Comments
 (0)