I have a function that returns dynamically generated JSON-LD as a string. I want to embed it in a script tag in my template.
This works:
<component :innerHTML="myJsonLdFunction(mySearchResult) :is="'script'" type="application/ld+json"></component>
But this does not work - the script tag stays empty:
<component v-html="myJsonLdFunction(mySearchResult)" :is="'script'" type="application/ld+json"></component>
What's the explanation for this difference? According to the documentation, v-html will "update the element's innerHTML". So it should work as well, right?