[Vuejs]-VueJs CLI import/compile html string to vue

0👍

You could use v-htmldirective which is used to render a static html content that doesn’t require any event handling or data binding, and according to official doc:

The contents of the span will be replaced with the value of the rawHtml property, interpreted as plain HTML – data bindings are ignored. Note that you cannot use v-html to compose template partials, because Vue is not a string-based templating engine. Instead, components are preferred as the fundamental unit for UI reuse and composition

another solution is to use the package v-runtime-template found in https://github.com/alexjoverm/v-runtime-template

This is probably useful for your use case, with all the usual concerns about safety of these approaches against malicious injections.

Leave a comment