父传子 class HelloWorld extends React.Component{ constructor(props) { super(props) this.state = { isActive:false } } render() { return ( <div> <button on ...
分类:
其他好文 时间:
2020-03-01 23:17:19
阅读次数:
79
一、在constructor中bind绑定组件的this: class Button extends React.Component{ constructor(pops){ super(); this.handleClick = this.handleClick.bind(this); } hand ...
分类:
其他好文 时间:
2020-03-01 22:08:46
阅读次数:
109
React.Component有三种手动绑定方法: 可以在构造函数中完成绑定 可以在调用时使用method.bind(this)来完成绑定 可以使用arrow function来绑定。 拿上例的handleClick函数来说,其绑定可以有: 1、构造函数绑定 constructor(props) { ...
分类:
其他好文 时间:
2020-03-01 21:57:50
阅读次数:
65
一.类的继承 #类的继承 class Animal(object): #Animal类继承object def __init__(self,color): self.color = color def eat(self): print("动物在吃!") def run(self): print("动 ...
分类:
编程语言 时间:
2020-03-01 14:30:45
阅读次数:
86
重温Objective-C的消息机制消息转发机制:首先在该类的缓存方法列表cache_method_list中查找,是否存在相关方法上一步中若没有命中,则从方法列表 objc_method_list中查找上一步中若没有命中,则从父类super的方法列表 objc_method_list中查找,直至根... ...
分类:
其他好文 时间:
2020-03-01 14:22:37
阅读次数:
111
因为临时需要在本机搭建一个nginx服务使用,其实很简单的一个本地server,但是运行的时候就报错: 192:~ superstar$ nginx nginx: [emerg] "upstream" directive is not allowed here in /usr/local/nginx ...
分类:
其他好文 时间:
2020-03-01 09:17:13
阅读次数:
77
Perceptual losses for real-time style transfer and super-resolution,2016 ECCV https://cs.stanford.edu/people/jcjohns/eccv16/ 官方源码Torch:https://github. ...
分类:
其他好文 时间:
2020-03-01 00:36:53
阅读次数:
53
python面向对象super函数 待办python面向对象可以多继承,同时集成的两个类继承自同一个父类的时候初始化问题,提前定义初始顺序,如果有相同的就按顺序初始化,不要把super理解成父类https://blog.csdn.net/robinjwong/article/details/4836... ...
分类:
编程语言 时间:
2020-02-29 13:16:09
阅读次数:
51
一、开闭原则定义 开闭原则(Open Closed Principle,OCP) 一个软件实体如类、模块和函数应该 对扩展开放, 对修改关闭 。所谓的开闭,也正是对扩展和修改两个行为的一个原则。强调的是用抽象构建框架,用实 现扩展细节。可以提高软件系统的可复用性及可维护性。开闭原则,是面向对象设计中 ...
分类:
其他好文 时间:
2020-02-28 22:54:31
阅读次数:
190
注: Python 2.7.x 环境下今晚搜东西无意中看到这篇Understanding Python super() with __init__() methods.其实这篇老早就看过了, 不过有一篇很好的回答之前没有注意到.首先说下super(), 我只在类的单继承时的__init__()中使用... ...
分类:
编程语言 时间:
2020-02-28 12:21:38
阅读次数:
70