Browse Source

【看板客户端】【布局刷新】

zhuth 8 years ago
parent
commit
53c2487172
1 changed files with 5 additions and 8 deletions
  1. 5 8
      kanban-client/app/component/Layout.js

+ 5 - 8
kanban-client/app/component/Layout.js

@@ -37,11 +37,6 @@ class BasicLayout extends React.Component {
     margin: [0, 0], // 元素间隔为0
   }
 
-  // 获得屏幕高度
-  getRowHeight() {
-    return window.innerHeight/10;
-  }
-
   // 创建div元素
   generateDOM() {
     const {items} = this.newProps;
@@ -65,7 +60,7 @@ class BasicLayout extends React.Component {
   // 设置每个div的属性
   generateLayout() {
     const {items} = this.newProps;
-
+    console.log('11');
     return items.map(function(item, i) {
       let {layout} = item;
       let {x, y, w, h} = layout;
@@ -79,10 +74,12 @@ class BasicLayout extends React.Component {
 
   componentWillReceiveProps(nextProps) {
     this.newProps = nextProps;
+    let layout = this.generateLayout();
+
     this.setState({
-      children: nextProps
+      children: nextProps,
+      layout: layout
     });
-    // console.log(this.newProps.items[0].config.option.title);
   }
 
   render() {