From 9be646b8ab5dd77d4c03520ac6a34186bc9df2cf Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Tue, 14 May 2019 17:42:46 +0800 Subject: [PATCH] fix(Amap): fix mapstyle --- src/map/AMap.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/map/AMap.js b/src/map/AMap.js index d5bf7aae89..aa7a1a1719 100644 --- a/src/map/AMap.js +++ b/src/map/AMap.js @@ -38,15 +38,17 @@ export default class GaodeMap extends Base { initMap() { const mapStyle = this.get('mapStyle'); - switch (mapStyle) { - case 'dark': - this.set('mapStyle', Theme.DarkTheme.mapStyle); - break; - case 'light': - this.set('mapStyle', Theme.LightTheme.mapStyle); - break; - default: - this.set('mapStyle', mapStyle); + if (mapStyle) { + switch (mapStyle) { + case 'dark': + this.set('mapStyle', Theme.DarkTheme.mapStyle); + break; + case 'light': + this.set('mapStyle', Theme.LightTheme.mapStyle); + break; + default: + this.set('mapStyle', mapStyle); + } } this.set('zooms', [ this.get('minZoom'), this.get('maxZoom') ]); const map = this.get('map');