I'm trying render a component from string but I didn't succeed. My codes are bellow:
<template>
<div v-html="beautifyNotification(notification)"></div>
</template>
<script>
import { Link } from '@inertiajs/inertia-vue3'
import {compile,h} from "vue"
export default {
components: {
},
props: {
notifications: Object
},
methods: {
beautifyNotification (ntfction) {
return h(compile(`<Link :href="`+ntfction.from.username+`"
class="h6 notification-friend">`+ntfction.from.name+`
</Link>, commented on your new
<Link href="#" class="notification-link">profile status</Link>.`))
},
}
}
</script>
I tried render component with h and compile but it returned object object

<Link />inside the template. That's exactly how the components are supposed to be used 99% of the time.<todo-item />is used in the docs: v3.vuejs.org/guide/introduction.html#composing-with-components"<div>This is a string HTML</div>") then you usev-html. Docs: v3.vuejs.org/guide/template-syntax.html#raw-html