A highly customizable vue modal plugin

vuejs-modal

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

https://shaodahong.github.io/vuejs-modal/

Installation

$ npm i vuejs-modal -S

Usage

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:

<template>
    //html
</template>

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

GitHub