How to extract a TemplatePromise in another component #3032
Answered
by
antfu
antoniogiroz
asked this question in
Q&A
-
Hello! I'm trying to use the But the form in the modal is very long, so I want to extract it in a component called Here is a demo playground: https://stackblitz.com/edit/vitejs-vite-k1frby How can I wait for the Thanks a lot! |
Beta Was this translation helpful? Give feedback.
Answered by
antfu
Apr 27, 2023
Replies: 1 comment 1 reply
-
You could do: // Foo.vue
<script setup>
const TemplatePromise = createTemplatePromise()
defineExpose({
start: () => TemplatePromise.start()
})
</script> And then <script setup>
const el = ref()
function call() {
el.value?.start()
}
</script>
<template>
<Foo ref="el"/>
</template> |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
antoniogiroz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could do:
And then