<template> <div id="basicDataMap"></div> </template> <script> import { ref, reactive, toRefs, onMounted } from "vue"; export default { name: "basicDataMap", setup() { function initMap() { const BMap = window.BMap; var map = new BMap.Map("basicDataMap"); map.centerAndZoom("武汉", 15); map.enableScrollWheelZoom(true); } onMounted(() => { initMap(); }); return { initMap }; }, computed: {}, methods: {}, }; </script> <style lang="less" scoped> #basicDataMap { width: 100%; height: 100%; } </style>