A simple、highly customizable vue modal plugin.

This plugin which works only with Vue 2.0+

A file corresponds to a modal, and registered to vue prototype, so I can use it through this, it gives me a state of a promise, so I can get this modal state.

Live Demo


$ npm i vuejs-modal -S


import Modal from 'vuejs-modal'

// If you can use default template, you should be:
import confirm from 'vuejs-modal/lib/confirm.vue'

Vue.use(Modal, {
     modals: {
         confirm //default template
     }  //your modals, is a object 

Use in component:


export default {
    methods: {
        show: function () {
            this.$modal.confirm().then( res => {
                // I click ok button
            }).catch( rej => {
                // I click cancel button