2
0
mirror of https://github.com/frappe/books.git synced 2024-12-27 20:45:04 +00:00
books/ui/components/Modal/plugin.js

28 lines
583 B
JavaScript
Raw Normal View History

import ModalContainer from './ModalContainer';
import frappe from 'frappejs';
const Plugin = {
install(Vue) {
this.event = new Vue();
Vue.prototype.$modal = {
show(...args) {
2018-09-28 13:12:34 +00:00
return Plugin.modalContainer.add(...args);
},
hide(id) {
Plugin.event.$emit('hide', id);
}
};
frappe.showModal = Vue.prototype.$modal.show;
// create modal container
const div = document.createElement('div');
document.body.appendChild(div);
new Vue({ render: h => h(ModalContainer) }).$mount(div);
}
};
export default Plugin;