@@ -59,39 +59,45 @@ export default function (compPath) {
59
59
const uuid = geneUUID ( )
60
60
this . data . diuu = uuid
61
61
62
- const CompMySelf = wx . _pageCompMaps [ compPath ]
63
-
64
- renderPage (
65
- createElement (
66
- CompMySelf ,
67
- {
68
- routerParams : paramsObj ,
69
- diuu : uuid
70
- } ,
71
- ) ,
72
- this
73
- )
74
-
75
- const compInst = instanceManager . getCompInstByUUID ( this . data . diuu )
76
- //如果组件还未初始化 didFocus方法,保证执行顺序为: didMount --> didFocus
77
- if ( compInst . componentDidFocus ) {
78
- const focusFunc = compInst . componentDidFocus
79
- const didMountFunc = compInst . componentDidMount
80
-
81
- compInst . componentDidFocus = undefined
82
- compInst . componentDidMount = function ( ) {
83
- didMountFunc && didMountFunc . call ( compInst )
84
- focusFunc . call ( compInst )
85
- compInst . componentDidFocus = focusFunc
86
- compInst . componentDidMount = didMountFunc
87
- }
88
-
89
- }
62
+ //const CompMySelf = wx._pageCompMaps[compPath]
63
+
64
+ wx . _getCompByPath ( compPath )
65
+ . then ( ( CompMySelf ) => {
66
+
67
+ renderPage (
68
+ createElement (
69
+ CompMySelf ,
70
+ {
71
+ routerParams : paramsObj ,
72
+ diuu : uuid
73
+ } ,
74
+ ) ,
75
+ this
76
+ )
77
+
78
+ const compInst = instanceManager . getCompInstByUUID ( this . data . diuu )
79
+ //如果组件还未初始化 didFocus方法,保证执行顺序为: didMount --> didFocus
80
+ if ( compInst . componentDidFocus ) {
81
+ const focusFunc = compInst . componentDidFocus
82
+ const didMountFunc = compInst . componentDidMount
83
+
84
+ compInst . componentDidFocus = undefined
85
+ compInst . componentDidMount = function ( ) {
86
+ didMountFunc && didMountFunc . call ( compInst )
87
+ focusFunc . call ( compInst )
88
+ compInst . componentDidFocus = focusFunc
89
+ compInst . componentDidMount = didMountFunc
90
+ }
91
+
92
+ }
93
+
94
+
95
+ } )
90
96
}
91
97
92
98
o . methods . onShow = function ( ) {
93
99
const compInst = instanceManager . getCompInstByUUID ( this . data . diuu )
94
- compInst . componentDidFocus && unstable_batchedUpdates ( ( ) => {
100
+ compInst && compInst . componentDidFocus && unstable_batchedUpdates ( ( ) => {
95
101
compInst . componentDidFocus ( )
96
102
} )
97
103
}
0 commit comments