//在render生命周期函數(shù)中給返回的Dom添加一個類名
render() {
const {content} = this.props;
return (
<div onClick={this.handelClick} className={ 'show'}>{content}</div>
)
}
css樣式
.show{
font-size: 24px;
animation: hide-item 2s ease-in;
}
@keyframes hide-item{
0%{ opacity : 0;}
50% { opacity:0.5;}
100% { opacity:1;}
}