vue-baidu-map Add a point of a custom icon but how to make the custom picture displayed in the center (full display)

vue-baidu-map Add a point of a custom icon but how to make the custom picture displayed in the center (full display)

Since I go to the question column to ask questions, no matter how I modify it, it shows that there are illegal characters that cannot be published, so I will ask questions here, and I will give you some comments. Thank you

  <baidu-map class="mapDemo"
               :scroll-wheel-zoom="true"
               :center="center"
               :zoom="zoom"
               @ready="handler"
               ak="UvaCE1b5u2LGdxZwLtvSTtjj7Q3KdXja">
        <bm-marker 
        :position="{lng: 116.404, lat: 39.915}" 
        :dragging="true"
        :icon="{url:require('../../assets/img/a.jpg'),backgroundPosition:center, size: {width: 150, height: 300}}" 
        animation="BMAP_ANIMATION_BOUNCE">
        </bm-marker>
    </baidu-map>
<script>
import {BaiduMap ,BmMarker,BmLabel} from 'vue-baidu-map';
export default {
  name: "my",
  components:{
    BaiduMap,
    BmMarker,
    BmLabel
  },
  data() {
    return {
      center: {lng: 116.404, lat: 39.915},
      zoom: 15,
      labelStyle:{color: 'red', fontSize : '24px'}
    };
  },
  mounted() {
  },
  methods: {
    //地图
      handler ({BMap, map}) {
      console.log(BMap, map)
    }
  }
};
</script>

The effect is like this: The
Insert picture description here
actual picture
Insert picture description here
looks like this: Ask the big guys to answer and enlighten me!

After the subsequent research, it was concluded:

{
  url: String,
  size: Size,
  opts: {
    anchor: Size,
    imageOffset: Size,
    imageSize: Size,
    infoWindowAnchor: Size,
    printImageUrl: String
  }
}
//bm-marker里的icon属性共有以上几个,其中imageSize属性就可以实现

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43923146/article/details/112557639