import React, {Component} from 'react'; import style from './index.less' import showImg from "@common/images/show.png"; import hideImg from "@common/images/close.png"; class RecommendInspect extends Component { constructor(props) { super(props) this.state = { showAll: false } this.renderItem = this.renderItem.bind(this) } changeShowFlag() { this.setState({ showAll: !this.state.showAll }) } renderItem(item) { const { changeFlag } = this.props return changeFlag(item)} type="checkbox" checked={item.checked} /> } render() { const { title,list, changeFlag, border } = this.props const { showAll } = this.state const listAll = list.map(item => { return this.renderItem(item) }); let firstLineNum = 0; //第一行字数 let secondLineNum = 0; //第二行字数 const listHide = list.map((item, index) => { firstLineNum = firstLineNum + item.name.length + 2; if (firstLineNum > 26) { secondLineNum = secondLineNum + item.name.length + 2; if(secondLineNum > 20) { return; } else { return this.renderItem(item) } } else { return this.renderItem(item) } }); return (