Banou26
Banou26

Reputation: 129

How to append new components after init of the Vue [VueJS]

How to append a new element on the DOM and make that element be used by VueJS ?

For example in this https://jsfiddle.net/a0hnps42/1/ the element <lel>after</lel> is not transformed into <div class='lel'>lele</div> as <lel>before</lel> did.

Upvotes: 0

Views: 2358

Answers (1)

johnnynotsolucky
johnnynotsolucky

Reputation: 540

You could use scoped slots to dynamically add new components:

<ul>
  <slot name="item"
    v-for="item in items"
    :text="item.text">
    <!-- fallback content here -->
  </slot>
</ul>

https://github.com/vuejs/vue/releases/tag/v2.1.0

Upvotes: 1

Related Questions