From 3fa93ccf3603cff7d59fb3a8a14d09211b8870ee Mon Sep 17 00:00:00 2001 From: chenyongxin <59717382+Cyx649312038@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:09:59 +0800 Subject: [PATCH] fix: aMap repeat load issure fixed (#5490) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复Amap多次load导致报错的问题 * feat: branch restore * fix: aMap repeat load issure fixed * fix: aMap repeat load issure fixed * Delete packages/plugins/@nocobase/plugin-calendar/src/locale/zh-CN.ts --- lerna.json | 4 +--- .../src/client/components/AMap/Map.tsx | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lerna.json b/lerna.json index 03c4de816d..da39c8072b 100644 --- a/lerna.json +++ b/lerna.json @@ -2,9 +2,7 @@ "version": "1.3.39-beta", "npmClient": "yarn", "useWorkspaces": true, - "npmClientArgs": [ - "--ignore-engines" - ], + "npmClientArgs": ["--ignore-engines"], "command": { "version": { "forcePublish": true, diff --git a/packages/plugins/@nocobase/plugin-map/src/client/components/AMap/Map.tsx b/packages/plugins/@nocobase/plugin-map/src/client/components/AMap/Map.tsx index 4239bcba12..c1fd3798e4 100644 --- a/packages/plugins/@nocobase/plugin-map/src/client/components/AMap/Map.tsx +++ b/packages/plugins/@nocobase/plugin-map/src/client/components/AMap/Map.tsx @@ -335,6 +335,24 @@ export const AMapComponent = React.forwardRef { + map.current = new AMap.Map(id.current, { + resizeEnable: true, + zoom, + } as AMap.MapOptions); + aMap.current = AMap; + setErrMessage(''); + forceUpdate([]); + }); + return; + } catch (err) { + setErrMessage(err); + } + } + AMapLoader.load({ key: accessKey, version: '2.0',