mirror of
https://github.com/frappe/books.git
synced 2024-12-26 20:30:25 +00:00
25 lines
500 B
JavaScript
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; |