data() {
return {
fillColor: "#1afa29",
placeName: "name",
}
}
computed: {
customTowerIcon() {
let svgContent = `<svg class="icon" width="30" height="30" fill="${this.fillColor}" aria-hidden="true"><use xlink:href="#icon-tubiao_jingdongtieta" /></svg>`;
// let divContent = `<p style="color:white">${this.placeName}</p>`;
let customColorIcon = L.divIcon({
iconSize: [30, 30],
className: "custom-color-icon",
html: svgContent
});
return customColorIcon;
}
},
//使用
let marker = L.marker(latlngs, {
icon: this.customTowerIcon,
place: item.place
});