react中使用样式的两种方式

134 阅读1分钟

react中使用样式的两种方式:

(1)单独组件的样式文件

import './Person.css'

(2)行内样式

render(){
    const style = {
      color:'red',
      fontSize:'30px'
    }
    return(
      <div>
        <button style={style}>点击切换</button>
      </div>
    )
}


欢迎访问博客:blog.csdn.net/Miss_liangr…