[Vuejs]-How do I call a method from a dynamically added element in Vue

1👍

No. We don’t do that in VueJS.
For this situation I would use v-if / v-show to achieve this.

<div v-if="isConfirm">
    <div>Are you sure?</div>
    <div>
      <button @click="cancel" >CANCEL</button>
      <button @click="delete" >DELETE</button>
    </div>
</div>

Later in your data

data(){
    return {
        isConfirm: false
    }
},
method:{
    Popup(){
        this.isConfirm = true;
    }
}
👤markcc

Leave a comment