[Vuejs]-Reuse my Vue component that contains x-template?

0👍

Not a direct answer to your question but too big for a comment.

A different approach to only need one modal would be to take advantage of an anonymous component inside your single modal body.

<component ref="modal" v-bind:is="modalView" v-bind:item="item"></component>

Then to change the modal content you can just update the modalView property.

import editView from './components/modal/edit';
import deleteView from './components/delete';

showEditView() {
    this.modalView = editView;
    this.openModal();
}

Leave a comment