| | |
| | | iconAnchor: [24, 41], // 图标将对应标记点的位置 这个是重点, 【值1,值2】,值1:为图标坐标第一个值(即32)的一半,值2:为图标坐标第二个值(即52) |
| | | popupAnchor: [1, -24], // 该点是相对于iconAnchor弹出信息的位置 这个是我手动调出来的,文档默认原始值是[-1,-76],我是去一半值,取一半值调出来的 |
| | | }); |
| | | let icon = L.divIcon({ |
| | | html: "<div class='map-circle-name'></div>", |
| | | iconSize: [80, 80], |
| | | className: "map-circle", |
| | | }); |
| | | this.map = map; |
| | | if (info && info.length) { |
| | | for (let i = 0; i < info.length; i++) { |
| | | const item = info[i]; |
| | | const marker1 = L.marker([item.ycoord, item.xcoord], { |
| | | icon: DefaultIcon1, |
| | | icon: icon, |
| | | }).addTo(map); |
| | | marker1.on("click", (e) => { |
| | | this.menuNav = true; |
| | |
| | | height: 100%; |
| | | } |
| | | #map { |
| | | height: 1080px; |
| | | height: 100%; |
| | | width: 100%; |
| | | margin: 0 auto; |
| | | font-size: 14px !important; |
| | | } |
| | | ::v-deep .map-circle-name { |
| | | width: 20px; |
| | | height: 20px; |
| | | border-radius: 50%; |
| | | background-color: #2070bc; |
| | | } |
| | | </style> |