2
0
mirror of https://github.com/frappe/books.git synced 2024-12-24 11:55:46 +00:00

Return modal id in modal.show

This commit is contained in:
Faris Ansari 2018-09-28 18:42:34 +05:30
parent db7050512f
commit 5e9428a047
3 changed files with 6 additions and 4 deletions

View File

@ -7,7 +7,7 @@ const Plugin = {
Vue.prototype.$modal = { Vue.prototype.$modal = {
show(...args) { show(...args) {
Plugin.modalContainer.add(...args); return Plugin.modalContainer.add(...args);
}, },
hide(id) { hide(id) {

View File

@ -5,9 +5,11 @@ export default function installFormModal(Vue) {
Vue.mixin({ Vue.mixin({
computed: { computed: {
$formModal() { $formModal() {
let id;
const open = (doc, options = {}) => { const open = (doc, options = {}) => {
const { defaultValues = null, onClose = null } = options; const { defaultValues = null, onClose = null } = options;
this.$modal.show({ id = this.$modal.show({
component: Form, component: Form,
props: { props: {
doctype: doc.doctype, doctype: doc.doctype,
@ -23,7 +25,7 @@ export default function installFormModal(Vue) {
}); });
} }
const close = () => this.$modal.hide(); const close = () => this.$modal.hide(id);
return { return {
open, open,