Match-id-580af01343fa5bba627a04ab667a638ec280a603
This commit is contained in:
parent
d3260a4d94
commit
55dac3b56b
|
@ -1,18 +1,22 @@
|
||||||
/**
|
/**
|
||||||
* Component的api setState和forceUpdate在实例生成阶段实现
|
* Component的api setState和forceUpdate在实例生成阶段实现
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Component<P,S,C> {
|
class Component<P,S,C> {
|
||||||
props: P;
|
props: P;
|
||||||
context: C;
|
context: C;
|
||||||
state: S | null;
|
state: S | null;
|
||||||
refs: any;
|
refs: any;
|
||||||
setState: any;
|
|
||||||
forceUpdate: any;
|
forceUpdate: any;
|
||||||
|
|
||||||
constructor(props: P, context: C) {
|
constructor(props: P, context: C) {
|
||||||
this.props = props;
|
this.props = props;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setState(state: S) {
|
||||||
|
console.error('Cant not call `this.setState` in the constructor of class component, it will do nothing')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 兼容三方件 react-lifecycles-compat,它会读取 isReactComponent 属性值,不添加会导致 eview-ui 官网白屏
|
// 兼容三方件 react-lifecycles-compat,它会读取 isReactComponent 属性值,不添加会导致 eview-ui 官网白屏
|
||||||
|
|
Loading…
Reference in New Issue