diff --git a/src/components/BaiduMapPicker/index.js b/src/components/BaiduMapPicker/index.js index 794e142..eefc655 100644 --- a/src/components/BaiduMapPicker/index.js +++ b/src/components/BaiduMapPicker/index.js @@ -32,9 +32,12 @@ const BaiduMapPicker = ({ visible, onCancel, onConfirm }) => { type: "script", attr: { type: "text/javascript" }, }); - setTimeout(() => { - setLoaded(true); - }, 1000); + const timer = setInterval(() => { + if (window.BMap?.Map) { + setLoaded(true); + clearInterval(timer); + } + }, 500); }; if (window?.base?.loadDynamicResource) { callback();