[Vuejs]-How can I create a new component on firing any event using Vue.js?

0👍

You can append a component to another this way:

// the parent component
const CommentComponent = new Vue({
  template: '<div>...</div>'
})

// the child component
const EditCommentComponent = Vue.extend({
  template: '<div> child </div>'
})

CommentComponent.$addChild({}, EditCommentComponent).$mount().$appendTo(CommentComponent.$el)

If you wish to do this within the parent component, you can do this by replacing a with this.

– Source

Although as I have inferred from the comments, this would not be the most appropriate way to handle your case.

Leave a comment