제목과 마찬가지로 url의 끝에 #을 추가하지 못하게 할 수 있습니다.반응 라우터가 URL을 # 추가하는 것을 방지하려면 어떻게해야합니까?
내가 일을 많이 시도하지만 #없이 링크를 가져올 수 없습니다 blank1.jsx
method(current,previous){
const category= this.props.params.category;
const page = current;
const path = `/pathName/${category}/${page}`;
browserHistory.push(path);
...
}
에
(export default (withHistory, onUpdate) => {
const history = withHistory?
(Modernizr.history ?
browserHistory
: hashHistory)
: null;
return (
<Router history={history} onUpdate={onUpdate}>
<Route path='/' component={App}>
<IndexRoute component={quotes} />
<Route path='/app/search' component={SimpleSearch} />
<Route path='pathName' component={Blank1} />
<Route path='pathName/:category' component={Blank1}/>
<Route path='pathName/:category(/:page)' component={Blank1}/>
<Route path='app/:id' component={Blank1} />
</Route>
</Router>
);
};
방법
을 routes.jsx. 끝에 #가 추가되고 this.setState로 상태를 변경하는 구성 요소 WillReceiveProps가 계속 트리거됩니다. 그리고 네비게이션에서 탐색 항목 중 아무 것도 활성화되어 있지 않기 때문에 #
내 server.js에 해시 –