2017-11-26 11 views
0

반응 및 프레임 워크 7을 사용하여 모바일 웹 앱을 구축하려고하는데 프레임 워크 7의 라우팅이 어떻게 작동하는지 알 수없는 것 같습니다. 난 항상 렌더링 WallContainer를 얻을, 위의 구성으로Framework7 반응 라우팅이 작동하지 않습니다.

export default class AbstractPage extends Component { 
constructor(props) { 
    super(props); 

    this.state = { 
     initialized: false 
    }; 

    const logger = createLogger(); 
    const reducer = combineReducers({ ...props.reducer, routing: routerReducer }); 
    this.history = createBrowserHistory(); 
    const historyMiddleware = routerMiddleware(this.history); 
    this.store = createStore(reducer, applyMiddleware(promise(), historyMiddleware, logger, thunkMiddleware)); 

    this.routes: [ 
     {path: '/', component: WallContainer}, 
     {path: '/create', component: CreateContainer}, 
    ]; 
} 

render() { 
    return (
     <Provider store={this.store}> 
      <Router history={this.history}> 
       <Framework7App themeType="material" routes={this.routes}> 
       <Statusbar /> 
       <LeftPanel /> 
       <Views navbarThrough> 
        <View main url="/" dynamicNavbar> 
         <Pages> 
          <WallContainer /> 
         </Pages> 
        </View> 
       </Views> 
      </Framework7App> 
      </Router> 
     </Provider> 
    ); 
} 
} 

: 아래에서

는 framework7 응용 프로그램과 pagecontainer의 초기화를 볼 수 있습니다. '만들기'페이지를 가져 오기 위해 링크를 클릭하면 url이 localhost : 3000/create로 변경되지만 페이지는 변경되지 않고 wallcontainer는 계속 표시됩니다. 아무도 내가 여기서 뭘 잘못하고 있는지 알아? 감사!

답변

0

내 프레임 워크 7App 컨텍스트를 클래스에 추가하는 것을 잊어 버렸습니다.

WallContainer.contextTypes = { 
    framework7AppContext: PropTypes.object 
}; 

이 컨텍스트를 추가하지 않으면 경고 또는 예외가 발생하지 않지만 라우팅이 작동하지 않습니다.