8. 样式

This commit is contained in:
shikong 2024-10-26 16:33:25 +08:00
parent dc03a66560
commit 26cdf763f8
Signed by: Shikong
GPG Key ID: BD85FF18B373C341

View File

@ -18,23 +18,22 @@ export default class SonComponent extends React.PureComponent {
this.setState({
...this.state,
showChildrenBorder: !this.state.showChildrenBorder
}, (state)=>{
}, ()=>{
this.changeChildrenClass()
})
}
changeChildrenClass = () => {
if(this.state.showChildrenBorder){
this.setState({
...this.state,
childrenClass:[SonComponentCss.children]
})
} else {
this.setState({
...this.state,
childrenClass:[]
})
let childrenClass = []
if (this.state.showChildrenBorder) {
childrenClass = [SonComponentCss.children]
}
this.setState({
...this.state,
childrenClass
})
}
render() {