refactor(projects): 代码优化

This commit is contained in:
Soybean
2022-06-11 13:37:52 +08:00
parent 8e6e787543
commit 5fa822f4d4
3 changed files with 12 additions and 12 deletions

View File

@@ -11,9 +11,9 @@ const { load } = useScriptTag(BAIDU_MAP_SDK_URL);
const domRef = ref<HTMLDivElement>();
async function renderBaiduMap() {
if (!domRef.value) return;
async function renderMap() {
await load(true);
if (!domRef.value) return;
const map = new BMap.Map(domRef.value);
const point = new BMap.Point(114.05834626586915, 22.546789983033168);
map.centerAndZoom(point, 15);
@@ -21,7 +21,7 @@ async function renderBaiduMap() {
}
onMounted(() => {
renderBaiduMap();
renderMap();
});
</script>