刚刚接触react,之前的项目用的vue框架 ,想学习下react框架 ,这个项目就用react写了 ,现在遇到页面跳转的问题
import { routerRedux, Route, Switch } from 'dva/router';
<div className={styles.buttonList}>
<Button icon="plus" size="large">
<Route path="/pages/Create/AddPlane" component='./create/add_plane'>添加机票 </Route>
</Button>
<Button type="primary" size="large">
<Route path="/pages/Create/HotelList" component='./create/hotel_list'>下一步</Route>
</Button>
</div>
这样不行。。。
在按钮里面写个方法 在方法里面写跳转路由的话怎么写呢???
<div className={styles.buttonList}>
<Button icon="plus" size="large" onClick={addPlane}>
添加机票
</Button>
<Button type="primary" size="large" onClick={nextStep}>
下一步
</Button>
</div>
function addPlane() {
console.log('添加机票');
}
function nextStep() {
console.log('下一步');
}
你还要在路由里配置下路径1和2要调转的页面。
例如:
就要在main.js里配置下路由
配置里的入口文件,比如我的:
