self-cellular-layout-react
Advanced tools
@@ -82,3 +82,3 @@ 'use strict'; | ||
| }); | ||
| return list; | ||
| return { list: list, row: row }; | ||
| } | ||
@@ -99,7 +99,15 @@ }, { | ||
| // const colEmpty = Math.floor(colmun/2); // 首行空格数 | ||
| var imgList = this.getImgList(colmun, colmun2); | ||
| var _getImgList = this.getImgList(cols, colmun, colmun2, colEmpty), | ||
| list = _getImgList.list, | ||
| row = _getImgList.row; | ||
| var height = row % 2 ? Math.floor(row / 2) * boxAllH + boxAllH : Math.floor(row / 2) * boxAllH + boxAllH / 2; | ||
| return _react2.default.createElement( | ||
| 'div', | ||
| { style: { width: width + 'px' } }, | ||
| imgList.map(function (item, index) { | ||
| { style: { | ||
| width: width + 'px', | ||
| height: height + 'px' | ||
| } }, | ||
| list.map(function (item, index) { | ||
| return _react2.default.createElement( | ||
@@ -106,0 +114,0 @@ 'div', |
+1
-1
| { | ||
| "name": "self-cellular-layout-react", | ||
| "version": "1.0.2", | ||
| "version": "1.0.3", | ||
| "description": "6边形蜂窝布局react组件", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -50,3 +50,3 @@ import React, { Component } from 'react'; | ||
| }) | ||
| return list; | ||
| return {list,row}; | ||
| } | ||
@@ -60,6 +60,10 @@ render() { | ||
| // const colEmpty = Math.floor(colmun/2); // 首行空格数 | ||
| const imgList = this.getImgList(colmun, colmun2); | ||
| const {list, row} = this.getImgList(cols, colmun, colmun2, colEmpty); | ||
| const height = row%2 ? Math.floor(row/2)*boxAllH + boxAllH : Math.floor(row/2)*boxAllH + boxAllH/2; | ||
| return ( | ||
| <div style={{width: width+'px'}}> | ||
| {imgList.map((item,index) => { | ||
| <div style={{ | ||
| width: width+'px', | ||
| height: height+'px' | ||
| }}> | ||
| {list.map((item,index) => { | ||
| return ( | ||
@@ -66,0 +70,0 @@ <div className="cellular_row_box" key={index} data-index={index} |
15008
3.13%381
2.7%