I'm currently developing an interactive SVG map inspired by the one found on the CDC page. In my SVG map component, I have implemented multiple path elements that each contain a unique name
attribute representing the corresponding state. Additionally, I have integrated a bound class function that I aim to compute for each state as shown below:
<template>
<svg>
<path name="New York" :class="computeClass" />
<path name="California" :class="computeClass" />
<!-- etc -->
</svg>
</template>
While this might be a simple query, I am wondering if there is a way to pass the name
attribute of the element as a parameter into the computeClass()
function it invokes. Perhaps something like:
<path name="New York" :class="computeClass(this.name)" />
Your insights are greatly appreciated!