8. 样式

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

View File

@ -6,7 +6,7 @@ export default class SonComponent extends React.PureComponent {
state = { state = {
msg: "SonComponent Msg", msg: "SonComponent Msg",
showChildrenBorder: true, showChildrenBorder: true,
childrenClass: [SonComponentCss.children] childrenClass: []
} }
// constructor(props) { // constructor(props) {
@ -14,6 +14,10 @@ export default class SonComponent extends React.PureComponent {
// console.log(props) // console.log(props)
// } // }
componentDidMount() {
this.changeChildrenClass()
}
switchChildrenBorder = () => { switchChildrenBorder = () => {
this.setState({ this.setState({
...this.state, ...this.state,
@ -27,7 +31,6 @@ export default class SonComponent extends React.PureComponent {
let childrenClass = [] let childrenClass = []
if (this.state.showChildrenBorder) { if (this.state.showChildrenBorder) {
childrenClass = [SonComponentCss.children] childrenClass = [SonComponentCss.children]
} }
this.setState({ this.setState({