mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-02 08:06:38 +08:00
优化地图加载报错问题
This commit is contained in:
parent
202cb7b947
commit
8efbed2c28
@ -614,7 +614,7 @@ export default function UserByMap() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
const loadEcharts = () => {
|
const loadEcharts = async () => {
|
||||||
let chartDom = document.getElementById("userByMapChart");
|
let chartDom = document.getElementById("userByMapChart");
|
||||||
if (!chartDom) return;
|
if (!chartDom) return;
|
||||||
let myChart = echarts.init(chartDom, "default", {
|
let myChart = echarts.init(chartDom, "default", {
|
||||||
@ -623,8 +623,11 @@ export default function UserByMap() {
|
|||||||
});
|
});
|
||||||
option && myChart?.setOption(option);
|
option && myChart?.setOption(option);
|
||||||
};
|
};
|
||||||
|
try {
|
||||||
loadEcharts();
|
loadEcharts();
|
||||||
|
} catch (e) {
|
||||||
|
console.log("[loadEcharts] 地图加载失败", e);
|
||||||
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -660,7 +663,7 @@ export default function UserByMap() {
|
|||||||
style={{ width: "1080px", height: "600px" }}
|
style={{ width: "1080px", height: "600px" }}
|
||||||
></div>
|
></div>
|
||||||
<Script
|
<Script
|
||||||
src="https://api.map.baidu.com/api?v=3.0&ak=19e9FKQC49u5uQe4CBqan9ER2mYhQ3ip&callback=onBMapCallback"
|
src="https://api.map.baidu.com/api?v=3.0&ak=19e9FKQC49u5uQe4CBqan9ER2mYhQ3ip&callback=initMap"
|
||||||
strategy="beforeInteractive"
|
strategy="beforeInteractive"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user