鍍金池/ 問(wèn)答/HTML5  PHP  HTML/ react中路由參數(shù)獲取不到

react中路由參數(shù)獲取不到

路由: <Route path="/datareport/:name" component={ReportIndex}></Route>;
接收: `componentWillMount(){

   document.title="名稱"+this.props.params.name;
}`

訪問(wèn):http://localhost:3000/datareport/3
為何出錯(cuò)說(shuō)沒(méi)有name屬性

回答
編輯回答
喜歡你

檢查是否在 ReportIndex 執(zhí)行的,

2017年8月19日 21:24