例子 componentDidMount() { this.dataPolling = setInterval( () => { this.getAITraining(); }, 3000); } componentWillUnmount() { clearInterval(this.dataPolling); } getAITraining=()=>{ console.log('轮询测试 '+new Date()) }