06 2019 档案

摘要:1.componentWillMount 2.render 3.componentDidMount 4.componentWillUpdate 5.render 6.componentWillReceiveProps 这个生命周期用在子组件上: 触发时机是: (1)子组件接收了父组件传递的值 (2) 阅读全文

posted @ 2019-06-30 23:25 猫头唔食鱼 阅读(146) 评论(0) 推荐(0) 编辑

摘要:react里子组件不能直接操作父组件的数据。 所以要从父组件传递一个方法给子组件, 子组件获取到该方法后,把子数据传入该方法, 父组件才能获取到子数据 例子: 子组件 Child.js 父组件App.js 使用箭头函数的写法 子组件: 父组件 阅读全文

posted @ 2019-06-23 18:32 猫头唔食鱼 阅读(6904) 评论(0) 推荐(1) 编辑

摘要:删除元素,不要直接操作state里面的值,需要把要更改的值复制一份。 所以使用展开操作符,把数组复制一遍。 阅读全文

posted @ 2019-06-15 22:03 猫头唔食鱼 阅读(5649) 评论(0) 推荐(0) 编辑

摘要:import React ,{Component} from 'react' class App extends Component{ constructor(props){ super(props) this.state = { list:["星期一","星期二","星期三"] } } render(){ return ( ... 阅读全文

posted @ 2019-06-14 00:46 猫头唔食鱼 阅读(2126) 评论(0) 推荐(0) 编辑

摘要:import React, { Component } from 'react' class App extends Component { constructor(props) { super(props) //this.state = {} 定义数据 this.state = { inputValue: "" } } render()... 阅读全文

posted @ 2019-06-12 23:37 猫头唔食鱼 阅读(4084) 评论(0) 推荐(0) 编辑

摘要:react创建组件的方式有两种 1.定义一个类,让这个类继承Component,使用render方法 2.定义一个function,return一些标签 阅读全文

posted @ 2019-06-11 20:33 猫头唔食鱼 阅读(240) 评论(0) 推荐(0) 编辑

摘要:找到config文件夹里的index.js,build对象里的两个地方,更改成自己想要的名称 阅读全文

posted @ 2019-06-05 10:27 猫头唔食鱼 阅读(1778) 评论(0) 推荐(0) 编辑

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