06 2018 档案

摘要:组件生命周期 React Component通过其定义的几个函数来控制组件在生命周期的各个阶段的动作。 constructor(props, context) 构造函数,在创建组件的时候调用一次。 void componentWillMount() 在组件挂载之前调用一次。如果在这个函数里面调用setState,本次的render函数可以看到更新后的state,并且只渲染一次。 voi... 阅读全文
posted @ 2018-06-22 17:26 爱吃醋的工程师 编辑
摘要:e.preventDefault(); 阅读全文
posted @ 2018-06-22 17:25 爱吃醋的工程师 编辑
摘要:如果使用的是es6的语法,也就是采用继承React.Component的方法来构建组件的话,就不能使用getInitialState()函数,会报警告 Warning: getInitialState was defined on TodoApp, a plain JavaScript class. This is only supported for classes created using... 阅读全文
posted @ 2018-06-22 17:20 爱吃醋的工程师 编辑
摘要:①components:最基础的组件。这里面存放的只是最基本的UI组件,这些组件接收外部传过来的参数(数据),并将这些数据渲染的到界面。根据传入的参数的不同,界面渲染也不同。 ②container:contatiner负责将数据的组件进行连接,相当于将compontent组件和store里面的数据进行包装,生成一个新的有数据的组件。然后,在router.js配置文件中引用container中的组... 阅读全文
posted @ 2018-06-19 15:23 爱吃醋的工程师 编辑
摘要://自动调整 export default class test1 extends Component{ constructor(props) { super(props); this.handleChange = this.handleChange.bind(this) this.state={ items:[], text:'' }... 阅读全文
posted @ 2018-06-15 10:27 爱吃醋的工程师 编辑
摘要:export default class TimerTest extends Component{ constructor(props) { super(props); this.state = { seconds:0 }; } tick(){ this.setState(preState =>({ seconds:preSt... 阅读全文
posted @ 2018-06-15 10:13 爱吃醋的工程师 编辑
摘要:区别 阅读全文
posted @ 2018-06-07 21:45 爱吃醋的工程师 编辑

点击右上角即可分享
微信分享提示