You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

25 lines
510 B

// jsx 样式控制
// 1.行内样式:在元素身上绑定一个 style 属性即可
// 2.类名样式:在元素身上绑定一个 className 属性即可
import './App.css'
const style = {
fontSize: '30px',
color: 'blue'
}
// 动态控制类名,满足条件才有
var styleFlag = true
function App() {
return (
<div className="APP">
<span style={style}>6666666</span>
<span className={styleFlag ? 'active' : ''}>测试类名样式</span>
</div>
);
}
export default App;