2
0
mirror of https://github.com/frappe/books.git synced 2024-12-26 12:28:12 +00:00
books/ui/components/Modal/plugin.js
Faris Ansari 8f2c48c3df Modal
- Simplify modal plugin
- Support multiple stacked modals in a modal container
- Add formModal plugin
2018-07-10 19:05:43 +05:30

25 lines
493 B
JavaScript

import ModalContainer from './ModalContainer';
const Plugin = {
install (Vue) {
this.event = new Vue();
Vue.prototype.$modal = {
show(...args) {
Plugin.modalContainer.add(...args);
},
hide(id) {
Plugin.event.$emit('hide', id);
}
}
// create modal container
const div = document.createElement('div');
document.body.appendChild(div);
new Vue({ render: h => h(ModalContainer) }).$mount(div);
}
}
export default Plugin;