componentDidMount() {
let i = 0;
var itm = document.getElementsByClassName("test")[0];
var cln = itm.cloneNode();
document.getElementById("idid").appendChild(cln);
setInterval(() => {
// this.setState({
// testa: i++
// });
this.testa = i + 1;
}, 1000);
}
render(){
return (
<div id="idid">
<div className="test">{this.testa}</div>
</div>
)
}
复制dom元素,state不能获取
zhangguoqun
#1