Skip to content

Commit

Permalink
refactor(projects): 代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
Soybean committed Jun 11, 2022
1 parent 8e6e787 commit 5fa822f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/views/plugin/map/components/BaiduMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ 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);
map.enableScrollWheelZoom();
}
onMounted(() => {
renderBaiduMap();
renderMap();
});
</script>

Expand Down
8 changes: 4 additions & 4 deletions src/views/plugin/map/components/GaodeMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ const { load } = useScriptTag(GAODE_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 AMap.Map(domRef.value, {
zoom: 11,
center: [114.05834626586915, 22.546789983033168],
viewMode: '3D'
});
window.console.log(map);
map.getCenter();
}
onMounted(() => {
renderBaiduMap();
renderMap();
});
</script>

Expand Down
10 changes: 5 additions & 5 deletions src/views/plugin/map/components/TencentMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ const { load } = useScriptTag(TENCENT_MAP_SDK_URL);
const domRef = ref<HTMLDivElement | null>(null);
async function renderBaiduMap() {
if (!domRef.value) return;
async function renderMap() {
await load(true);
const map = new TMap.Map(domRef.value, {
if (!domRef.value) return;
// eslint-disable-next-line no-new
new TMap.Map(domRef.value, {
center: new TMap.LatLng(39.98412, 116.307484),
zoom: 11,
viewMode: '3D'
});
window.console.log(map);
}
onMounted(() => {
renderBaiduMap();
renderMap();
});
</script>

Expand Down

1 comment on commit 5fa822f

@vercel
Copy link

@vercel vercel bot commented on 5fa822f Jun 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.