Is it possible render vue component in composable #10904
Unanswered
ademyalcin27
asked this question in
Help/Questions
Replies: 1 comment 2 replies
-
Yes! You could return a VNode/Component. import CompImport from './Bar.vue'
export function useFoo() {
const vnode = h('div', 'hello')
const FunctionalComp = () => h('div', 'Functional! ')
const Comp = defineComponent(() => {
return () => h('div', 'world')
})
return {
vnode,
FunctionalComp,
Comp,
CompImport,
CompImportChanged: () => h(CompImport, { foo: 'bar' })
}
} <script setup>
const { vnode, Comp } = useFoo()
const V = () => vnode
</script>
<template>
<V />
<Comp />
</template> |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I want to render vue component in composable method and I need HTML output I will add to DOM.
Is there any solution for that
thanks
Beta Was this translation helpful? Give feedback.
All reactions