mirror of
https://github.com/KevinMidboe/vue-js-modal.git
synced 2026-02-03 15:25:31 +00:00
Replaced with the newer version
This commit is contained in:
30
Modal/index.js
Normal file
30
Modal/index.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import Vue from 'vue';
|
||||
import Modal from './Modal.vue';
|
||||
|
||||
const VueModal = {
|
||||
install(Vue, options = {}) {
|
||||
if (!this.hasOwnProperty("event")) {
|
||||
this.event = new Vue();
|
||||
}
|
||||
|
||||
const $modal = {
|
||||
show(name, params) {
|
||||
VueModal.event.$emit('toggle', name, true, params);
|
||||
},
|
||||
hide(name, params) {
|
||||
VueModal.event.$emit('toggle', name, false, params);
|
||||
}
|
||||
};
|
||||
|
||||
Object.defineProperty(Vue.prototype, '$modal', {
|
||||
get: () => $modal
|
||||
});
|
||||
|
||||
Vue.component('nice-modal', Modal);
|
||||
return null;
|
||||
},
|
||||
};
|
||||
|
||||
Vue.use(VueModal);
|
||||
|
||||
export default VueModal;
|
||||
Reference in New Issue
Block a user