diff --git a/src/modal_dialog/index.js b/src/modal_dialog/index.js index 62db6eec8..bf30155ed 100644 --- a/src/modal_dialog/index.js +++ b/src/modal_dialog/index.js @@ -72,7 +72,9 @@ export default () => { model.on('change:open', (m, enb) => triggerEvent(enb, em)); model.on( 'change', - debounce(() => em.trigger('modal', this._evData())) + debounce(() => { + em.trigger('modal', this._evData()); + }) ); return this; @@ -100,10 +102,12 @@ export default () => { * @return {this} */ open(opts = {}) { + const attr = opts.attributes || {}; opts.title && this.setTitle(opts.title); opts.content && this.setContent(opts.content); + model.set('attributes', attr); model.open(); - modal && modal.updateAttr(opts.attributes); + modal && modal.updateAttr(attr); return this; }, diff --git a/src/modal_dialog/model/Modal.js b/src/modal_dialog/model/Modal.js index e5fcbd952..90bffa966 100644 --- a/src/modal_dialog/model/Modal.js +++ b/src/modal_dialog/model/Modal.js @@ -5,6 +5,7 @@ export default class Modal extends Model { return { title: '', content: '', + attributes: {}, open: false }; }