董国庆
2025-02-24 79daa61e67eec4220f5dcd46eaafe0423b3a42d5
H5/pages/location/location.vue
@@ -5,8 +5,9 @@
            <image src="/static/location/back.png" class="w-19 h-35" mode=""></image>
         </view>
      </u-navbar>
      <div id="baidu-map"></div>
      <view class="" id="container">
      </view>
      <view class="">
         <view class="searchMain mb-35">
            <view class="search fs-27 ">
@@ -39,25 +40,18 @@
         };
      },
      mounted() {
         this.initMap();
      },
      methods: {
         initMap() {
            // 创建地图实例
            const map = new BMapGL.Map('baidu-map');
            // 设置中心点坐标
            const point = new BMapGL.Point(116.404, 39.915);
            // 初始化地图,设置中心点和缩放级别
            map.centerAndZoom(point, 15);
            // 开启鼠标滚轮缩放
            map.enableScrollWheelZoom(true);
         }
      }
       onReady() {
          var map = new BMapGL.Map("container");          // 创建地图实例
          var point = new BMapGL.Point(116.404, 39.915);  // 创建点坐标
          map.centerAndZoom(point, 15);
       }
   }
</script>
<style lang="scss" scoped>
   #baidu-map {
   #container {
      width: 100vw;
      height: 517rpx;
   }