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

25 lines
493 B
JavaScript
Raw Normal View History

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;