amapLong.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <div>
  3. <div id="container">
  4. </div>
  5. </div>
  6. </template>
  7. <script>
  8. export default {
  9. name:'amapLong',
  10. props:["row","arriveIcon"],
  11. data(){
  12. return {
  13. }
  14. },
  15. mounted(){
  16. this.getMap();
  17. },
  18. methods:{
  19. getMap(){
  20. var _this = this;
  21. var map = new AMap.Map('container', {
  22. resizeEnable: true, //是否监控地图容器尺寸变化
  23. zoom:18,
  24. center:[_this.row.poleLng, _this.row.poleLat]
  25. });
  26. // map.setFeatures(['bg', 'road', 'building']);
  27. // map.setCity('长沙市');
  28. // map.setMapStyle("amap://styles/blue");
  29. // new AMap.Marker({
  30. // map:map,
  31. // icon:"http://106.52.134.22:9080/000000-bladex/upload/20200606/diangan.png",
  32. // position:[item.poleLng, item.poleLat],
  33. // autoRotation: true
  34. // });
  35. var circle = new AMap.Marker({
  36. position:[_this.row.poleLng, _this.row.poleLat ],
  37. // radius:100,
  38. // strokeColor:"#fff",
  39. // strokeOpacity:1,
  40. // strokeWeight:3,
  41. // fillColor:"#fff",
  42. // fillOpacity:1
  43. map:map,
  44. icon:_this.arriveIcon || "http://106.52.134.22:9080/000000-bladex/upload/20200606/diangan.png",
  45. autoRotation:true
  46. });
  47. map.add(circle);
  48. }
  49. }
  50. }
  51. </script>
  52. <style scoped>
  53. #container{
  54. width:600px;
  55. height:300px;
  56. }
  57. #container >>> .amap-icon img{
  58. width:71px !important;
  59. height:71px !important;
  60. }
  61. </style>