自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

then啥

自言自语,如有错误欢迎指正

  • 博客(8)
  • 收藏
  • 关注

转载 react子组件如何通过父组件传入的函数,将自己的值再传回父组件

class Son extends React.Component { render() { return <input onChange={this.props.onChange}/>; } } class Father extends React.Component { constructor() { super(); this.state ...

2019-01-24 16:39:29 783

转载 react协调算法(页面更新机制)

对比算法:当对比两棵树时,React首先比较两个根节点。根节点的type不同,其行为也不同   1. 不同类型的元素:卸载(销毁旧的节点及状态)旧的元素重建新的元素 <div> <Counter /> </div> <span> <Counter /> </span> 2. 相同类型元素:对比属性,仅更新变...

2019-01-18 16:18:14 796

转载 react中es6的使用

1. class创建组件 class Greeting extends React.Component { render() { return <h1>Hello, {this.props.name}</h1>; } } 2. 声明默认属性 class Greeting extends React.Component { // ... } G...

2019-01-18 15:23:46 2353

原创 受控组件与非受控

 受控:通过state与onChange控制 class Form extends Component { constructor() { super(); this.state = { name: '', }; } handleNameChange = (event) => { this.setState({ name: eve...

2019-01-18 11:18:08 658

转载 react中setState的隐患

隐患出处:setState异步更新状态 https://ruby-china.org/topics/32715 https://www.jianshu.com/p/c6257cbef1b1   浅合并(shallow merge):当调用setState修改组件状态时,只需要传入发生改变的State,而不是组件完整的State 如:return {...state, orders: **...

2019-01-17 11:21:23 621

原创 多余文字隐藏,悬浮显示

width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; &:hover{ overflow: visible; }  

2019-01-17 10:12:03 1135

原创 有border-radius的div做hover

需要在整个最外层上加overflow: hidden才有效

2019-01-17 10:11:35 299

转载 利用react的state机制实现钟表计时器

涉及:state、生命周期钩子   class Clock extends React.Component { constructor(props) { super(props); this.state = {date: new Date()}; } componentDidMount() { this.timerID = setInterval( ...

2019-01-17 10:11:13 1379

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除