|
|
@@ -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() {
|