I need compile custom vue js script and render it on page
Example:
let js = `"Hello, please choose your variant:<br /> <pool :id='144'>"`
const component = Vue.compile(js)
After (for example):
<div class="user-post">
<component :is="component" />
</div>
How i can implement this with vue?
2
Answers
Solution:
After
Vue SFC Playground
You need several things here:
compile()
. Note that for that you need a different Vue build in vite.config.js (see below).components
property to, so the Vue would know components used in the original HTML.v-bind
.vite.config.js