Browse Source

Add modal attributes in model

pull/3795/head
Artur Arseniev 5 years ago
parent
commit
b442bdb4d6
  1. 8
      src/modal_dialog/index.js
  2. 1
      src/modal_dialog/model/Modal.js

8
src/modal_dialog/index.js

@ -72,7 +72,9 @@ export default () => {
model.on('change:open', (m, enb) => triggerEvent(enb, em)); model.on('change:open', (m, enb) => triggerEvent(enb, em));
model.on( model.on(
'change', 'change',
debounce(() => em.trigger('modal', this._evData())) debounce(() => {
em.trigger('modal', this._evData());
})
); );
return this; return this;
@ -100,10 +102,12 @@ export default () => {
* @return {this} * @return {this}
*/ */
open(opts = {}) { open(opts = {}) {
const attr = opts.attributes || {};
opts.title && this.setTitle(opts.title); opts.title && this.setTitle(opts.title);
opts.content && this.setContent(opts.content); opts.content && this.setContent(opts.content);
model.set('attributes', attr);
model.open(); model.open();
modal && modal.updateAttr(opts.attributes); modal && modal.updateAttr(attr);
return this; return this;
}, },

1
src/modal_dialog/model/Modal.js

@ -5,6 +5,7 @@ export default class Modal extends Model {
return { return {
title: '', title: '',
content: '', content: '',
attributes: {},
open: false open: false
}; };
} }

Loading…
Cancel
Save