File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ export class RootRenderer extends React.Component<RootRendererProps> {
3939 this . store . updateContext ( props . context , true ) ;
4040 this . store . initData ( props . data ) ;
4141 this . store . updateLocation ( props . location , this . props . env ?. parseLocation ) ;
42- this . store . setGlobalVars ( props . globalVars ) ;
4342
4443 // 将数据里面的函数批量的绑定到 this 上
4544 bulkBindFunctions < RootRenderer /*为毛 this 的类型自动识别不出来?*/ > ( this , [
@@ -85,6 +84,9 @@ export class RootRenderer extends React.Component<RootRendererProps> {
8584 }
8685
8786 componentDidMount ( ) {
87+ // 不要设置太早,否则组件内部的监控可能会监控不到,因为初始值可能在监控之前就设置了。
88+ // 以至于监控不到变化。
89+ this . store . setGlobalVars ( this . props . globalVars ) ;
8890 document . addEventListener (
8991 'visibilitychange' ,
9092 this . handlePageVisibilityChange
You can’t perform that action at this time.
0 commit comments