I use vue-inline-svg to inline some svg’s in my project.
It works fine when I call the svg like this:
<inline-svg src="/img/logo.svg" class="logo"></inline-svg>
But I have the following situation:
I have svg path’s defined in the router (because they are navigational icons):
{
path: '/:city/the-thing',
name: 'The Thing',
component: thingView,
iconPath: '/img/icon-thing.svg',
},
I’ cant figure out how to write the syntax:
I write a navigation Loop:
<template v-for="value in $router.options.routes">
<RouterLink :to="{ name: value.name, params: { city: currentCity } }">
<img :src="value.iconPath" alt=""> // this should be the inlined svg
</RouterLink>
</template>
I tried to write it like this:
<inline-svg :src="require(`${value.iconPath}`)"/>
and several other variations but to no avail.
Do you know the correct syntax?