請教各位師兄了。我創(chuàng)建了一個組件Component,并在內(nèi)部中的一個ajax成功回調(diào)內(nèi),寫了this.context.router.push("/user/list")類似的跳轉(zhuǎn)功能。同時在組件外寫了Component.contextTypes={ router: React.PropTypes.object.isRequired }。ajax也成功請求了,但是頁面并沒有跳轉(zhuǎn),有點疑問了。。。代碼結(jié)構(gòu)類似:class Component extends React.Component{ ... success: function(data) { alert(data); this.context.router.push(...) }}Component.contextTypes={ router: React.PropTypes.object.isRequired}
Reactjs關于函數(shù)內(nèi)跳轉(zhuǎn) this.context.router.push(path)的問題
UYOU
2018-11-14 21:29:17