|
@@ -34,15 +34,14 @@ class CheckBody extends Component{
|
|
|
let arr = [],list=[];//console.log(data,saveText)
|
|
|
const {boxMark,showAll} = this.state;//console.log(data)
|
|
|
const moreNum =data.length-[...data].reverse().findIndex((it)=>it.showInCheck)-1;//被隐藏的位置
|
|
|
- //console.log(moreNum,this.props.defaultShowAll,showAll);
|
|
|
const moreText = filterDataArr([...saveText].splice(moreNum)); //被收起的标签中是否有有值得,有则不能再收起showMoreBtn?more:''
|
|
|
- const more = this.props.defaultShowAll||showAll?<span className={style['more']} onClick={this.showHide}>收起<img src={hideImg} /></span>:<span className={style['more']} onClick={this.showHide}>展开<img src={showImg} /></span>;
|
|
|
+ const more = showAll?<span className={style['more']} onClick={this.showHide}>收起<img src={hideImg} /></span>:<span className={style['more']} onClick={this.showHide}>展开<img src={showImg} /></span>;
|
|
|
const showMoreBtn = data.length>moreNum&&!moreText;
|
|
|
let showArray = data.filter((it)=>{
|
|
|
if(it.showInCheck)
|
|
|
return it;
|
|
|
});
|
|
|
- const showData = moreText||this.props.defaultShowAll||showAll?[...data]:showArray;//[...data].splice(0,config.showCheckNum*2+1);
|
|
|
+ const showData = moreText||showAll?[...data]:showArray;//[...data].splice(0,config.showCheckNum*2+1);
|
|
|
if(showData){
|
|
|
list = showData;
|
|
|
arr = list.map((it,i)=>{
|
|
@@ -115,9 +114,9 @@ class CheckBody extends Component{
|
|
|
});
|
|
|
}
|
|
|
componentWillUpdate(next){
|
|
|
- if(!this.props.isEmpty&&next.isEmpty){
|
|
|
+ if((this.props.defaultShowAll&&!next.defaultShowAll)||(!this.props.defaultShowAll&&next.defaultShowAll)||(!this.props.isEmpty&&next.isEmpty)){
|
|
|
this.setState({
|
|
|
- showAll:false
|
|
|
+ showAll:next.defaultShowAll
|
|
|
})
|
|
|
}
|
|
|
}
|