T
T
tenaro2021-11-15 18:48:13
JavaScript
tenaro, 2021-11-15 18:48:13

How to programmatically create a new component in vue3 composition api?

You need to write a component in which you can add the same

Parent.vue component:

<template>
   <Editor :data="data" />
</template>


editor.vue:
<template>
   <div class="editor">
      I'm editor {{ data }}
      // сюда надо добавить <Editor /> при нажатии на кнопку и передать данные
   </div>
   <button @click="addNewEditor"></button>
</template>

<script setup>
 const addNewEditor = () => ???
</script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-11-15
@tenaro

Nothing has changed since vue 2: you need a name :

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question