Right now I am using vuetify and vue js to implement the map functionality in my application. I am using vue2-google-maps package to implement it and as of now it works fine for me.
Now I want to change the color of the icon and I am using the following url to change the color of the icon "http://maps.google.com/mapfiles/ms/icons/orange-dot.png"
and my HTML code looks like below
<gmap-map
:center="center"
:zoom="7"
style="width:50%; height: 400px;"
>
<gmap-marker
:key="index"
v-for="(m, index) in markers"
:position="m"
icon= "http://maps.google.com/mapfiles/ms/icons/green-dot.png"
@click="center=m"
></gmap-marker>
</gmap-map>
now instead of passing direct url to icon, Can I create a function where it checks certain condition and return different type of color url for each condition to the icon. If that possible can you let me know how to achieve it
You can put the value of the different icons inside the data and create a variable that is null.This null variable will be the value of your icon.
In the code I made, I used radio buttons that will change the Marker icons everytime I check a radiobutton for the specific color. To explain,I used a listener(methods) to the radiobutton changes. Inside this method, I put my if else condition for the iconColor value. Here's a sample code and code snippet below: