ReactJS遇到的问题 - 草稿 - 草稿

2021-05-10  本文已影响0人  天蓝_d82b

1、手动设置控件高度

<div style={{width:xxx}}2>

2、屏幕宽高innerWidth,offsetWidth等等

https://www.jianshu.com/p/801637947505

3、界面跳转最好使用history来控制,使用方法如下:

CMD中输入:npm install history --save

import {createHashHistory} from 'history';

history = createHashHistory();

this.history.push('地址');//地址起始不用加'.'

  1)、push('xxx'):加入历史堆栈,可通过返回键返回

  2)、replace('xxx'):不加入堆栈,不可通过返回键返回

  3)、go(x):回退到第几页,0代表当前页,-1代表上一页,-2代表上上页,以此类推

4、控件中通过props往控件传值时,一定要加上componentWillReceiveProps方法,防止拿到的都是旧数据

上一篇 下一篇

猜你喜欢

热点阅读