1

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?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.