2
0
mirror of https://github.com/frappe/books.git synced 2024-12-26 20:30:25 +00:00
books/ui/components/Modal/plugin.js
2018-09-28 18:42:34 +05:30

25 lines
500 B
JavaScript

import ModalContainer from './ModalContainer';
const Plugin = {
install (Vue) {
this.event = new Vue();
Vue.prototype.$modal = {
show(...args) {
return 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;