Home > Blockchain >  Nuxt-Gmaps clusterStyle local icon
Nuxt-Gmaps clusterStyle local icon

Time:09-05

I am using Nuxt-Gmaps and would like to add a local clusterStyle icon.

My code

clusterStyle: [
  {
    url: "~/assets/img/map_cluster.svg",
    width: 48,
    height: 48,
    textColor: "#000"
  }
],

The snippet is used here

<GMap
    
    ref="gMap"
    language="en"
    :cluster="{options: {styles: clusterStyle}}"
    :options=mapOptions
  >

I have found a workaround, when I put the icon in the static folder, but this isn't really best practice.

CodePudding user response:

you will need to use require here

clusterStyle: [
  {
    url: require("@/assets/img/map_cluster.svg"),
    width: 48,
    height: 48,
    textColor: "#000"
  }
],
  • Related