This commit is contained in:
zhangds 2022-10-18 16:07:11 +08:00
commit 85a0309e1c
1 changed files with 7 additions and 9 deletions

View File

@ -49,27 +49,25 @@ export default class bottomBar extends React.Component {
this.setState({active:index});
}
componentDidMount(){
let config = JSON.parse(sessionStorage.getItem('editorConfig'));
if (config && config.coupon && config.coupon.product_list) {
let { navlist, defaultText, selectText, background, iswitch } = config.coupon.product_list.bottomBar;
this.setState({ defaultText, selectText, background, iswitch });
let naVisual=navlist.filter(item=>item.iswitch);
this.setState({navList:naVisual});
}
let config = JSON.parse(sessionStorage.getItem('editorConfig'));
let { navlist, defaultText, selectText, background, iswitch } = this.props.bottomBarConfig?this.props.bottomBarConfig:config.coupon.product_list.bottomBar;
this.setState({ defaultText, selectText, background, iswitch });
let naVisual=navlist.filter(item=>item.iswitch);
this.setState({navList:naVisual});
}
render() {
let active=this.state.active;
return (
<ul className='bottomBar-view' style={{ background:this.props.bottomBarConfig.background? `url('${this.props.bottomBarConfig.background}') center center /cover`:'#f9f9f9'}}>
{
this.state.navList.length>1?this.state.navList.map((item,index)=>{
this.state.navList.map((item,index)=>{
return(
<li onClick={e=>this.clickIcon(e,index)} key={item.id}>
<img src={active==index?item.pic.selectShow:item.pic.show} alt=""/>
<span style={{color:active==index?this.props.bottomBarConfig.selectText:this.props.bottomBarConfig.defaultText}}>{item.text}</span>
</li>
)
}):null
})
}
</ul>
)