diff --git a/demoHtml/flex/js/index.js b/demoHtml/flex/js/index.js index 97e4c04..6c0a7cc 100644 --- a/demoHtml/flex/js/index.js +++ b/demoHtml/flex/js/index.js @@ -147,6 +147,13 @@ handleRemoveComponent(item); }); }); + + self['grid'].on('change', function (_event, itemArray) { + console.log(itemArray, '这里触发了布局的change事件'); + itemArray.forEach((item) => { + handleChangeComponent(item, self); + }); + }); }; // 处理添加组件之后的操作 @@ -247,6 +254,15 @@ }); }; + var handleChangeComponent = (component) => { + if (currentComponent && currentComponent.id === component.id) { + let width = component.w * (1920 / 24); + $('#width').val(width); + let height = component.h * cellHeight * 2; + $('#height').val(height); + } + }; + var handleRemoveComponent = (component) => { if (currentComponent && currentComponent.id === component.id) { currentComponent = null;