I need to incorporate dynamic SVG code into my <template>
without using v-html
or any wrapper around it.
The desired end result should look like the following, but template
does not support v-html
to achieve this. If there is a way to accomplish this result with v-html
or any workaround, that would be perfect.
<template>
<svg>
</svg>
<template>
Here is my current code:
<template>
<div>
<span v-html="svgData"></span>
</div>
</template>
<script setup lang="ts">
import { computed } from "vue";
import type { mainIcon } from "tester";
import { completeDataSet } from "tester";
const props = defineProps<{
icon: mainIcon;
}>();
const iconPassed = completeDataSet.find((item) => item.name === props.icon);
const svgData = computed(() => iconPassed?.data);
</script>
Note: The SVG data is returned as a string by a third-party library, so I cannot modify the SVG structure.
Thank you in advance.