1.0.5 • Published 6 years ago
vue-modal-js v1.0.5
Usage
Modal extends sweet-modal-vue functionalities. Also you can open your component in popup. Demo
Examples of using:
# install it via npm
npm install vue-modal-js --save
// register the plugin on vue
import Modal from 'vue-modal-js'
Vue.use(Modal)
// add to your base template
<modal></modal>
// simple modal
this.$modal('My message')
// configuring
this.$modal({icon:'warning',title: 'My custom title',text: 'My message'})
// Animated icon to show upon opening the modal.
// One of these values:
// - success
// - info
// - warning
// - error
// component to modal (you can specify props)
// include component
import MyComponent from './my-component.vue'
// or dynamic
Vue.component('MyComponent', function (resolve, reject) {
require(['./my-component.vue'], resolve)
});
this.$modal({component: MyComponent, data: {name: userName, email: userEmail }})
// closing
this.$modal('close')
or
this.$modal.close()
Also you can use it locally
// register the plugin on vue
import Modal from 'vue-modal-js/modal.vue'
export default {
components: {
vueModal
}
// add to your base template
<vue-modal ref="modal"></vue-modal>
// use it
this.$refs.modal.open('My message')