How to set custom Marker icon?
in <v-map>-tag:
<v-icondefault :image-path="path"></v-icondefault>
in your ts-file
components:{ 'v-icondefault': Vue2Leaflet.IconDefault}
look at examples/components/custompath.vue
The answer was:
v-marker(:icon="icon")
Where icon is:
icon () {
return L.icon({
iconUrl: url,
iconSize: [40, 40],
iconAnchor: [20, 20]
})
}
How do i set custom Marker icon in a \
<v-map :zoom="zoom" :center="center">
<v-marker v-for="item in markers" :key="item.key" :lat-lng="item.position" :icon="item.icon" :visible="true" v-on:l-click="onMarkerClick(item)"></v-marker>
</v-map>
The type of item.icon has to be L.icon (from leaflet)
Here is an example:
return L.icon({
iconUrl: 'src/assets/leaflet/marker-blue.svg',
shadowUrl: 'src/assets/leaflet/marker-shadow.png',
iconSize: [38, 95], // size of the icon
shadowSize: [50, 64], // size of the shadow
iconAnchor: [22, 94], // point of the icon which will correspond to marker's location
shadowAnchor: [4, 62], // the same for the shadow
popupAnchor: [-3, -76] // point from which the po
});
It' not worked(Error)
My component is l-marker, not v-marker
Maybe the code will be different?
any solution, please help~
Yeah it's old source Code from me. You have replace v with l. I'm not really sure why you're talking about l-maker. I think the webcomponent is l-marker with a r
yes, it's l-marker
how can i use custom icon on these components?
hmmn there are two possibilities:
Bestian Tang 小巴 notifications@github.com schrieb am Fr., 26. Okt. 2018 um
06:57 Uhr:
yes, it's l-marker
how do i use custom icon on these components?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/KoRiGaN/Vue2Leaflet/issues/42#issuecomment-433286467,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHqlTkE9ERhjyqtilX6CZ_AhYqXDaLHsks5uopY9gaJpZM4NfXs9
.
Most helpful comment
The type of item.icon has to be L.icon (from leaflet)
Here is an example: