I am encountering an issue with the MyComponent.vue component:
<template>
<div v-html="content"></div>
</template>
<script>
import Vue from 'vue'
import CustomComponent from 'CustomComponent.vue'
Vue.use(CustomComponent)
export default {
name: `my-component`,
computed: {
content() {
return this.$store.state.content
}
},
asyncData({store, route: {params: {id}}}) {
// fetching 'content' from REST API here
return store.dispatch('FETCH_CONTENT', {id})
},
// ...
}
</script>
The html-string this.$store.state.content
is obtained from a REST API. For example:
<custom-component data-count="1"></custom-component><p>some text</p>
In my case, the custom-component
tag is not rendering.
My question is whether it is possible to render a vue component from the html-string retrieved from a REST API when using it in v-html
?