@@ -32,10 +32,7 @@ function getOptions (Component) {
32
32
class GetReactRouterPropsCom extends React . Component {
33
33
constructor ( props ) {
34
34
super ( props )
35
- let { history, match, location, forwardRef, ...newProps } = props
36
- this . state = {
37
- ...newProps
38
- }
35
+ let { history, match, location } = props
39
36
// 设置react router属性绑定倒所有的vue的原型上
40
37
setReactRouterInVue ( {
41
38
history,
@@ -52,7 +49,8 @@ class GetReactRouterPropsCom extends React.Component {
52
49
} )
53
50
}
54
51
render ( ) {
55
- return < VueComponentLoader { ...this . state } ref = { this . props . forwardRef } />
52
+ const { history, match, location, ...newProps } = this . props
53
+ return < VueComponentLoader { ...newProps } ref = { this . props . forwardRef } />
56
54
}
57
55
}
58
56
const VueContainer = React . forwardRef ( ( props , ref ) => {
@@ -145,7 +143,6 @@ class VueComponentLoader extends React.Component {
145
143
// 处理v-model
146
144
doVModel ( props ) {
147
145
let { $model, ...newProps } = props
148
- return { ...newProps }
149
146
if ( $model === undefined ) return props
150
147
// 考虑到了自定义v-model
151
148
let vueInstanceModelOption = { ...{ prop : 'value' , event : 'input' } , ...getOptions ( this . currentVueComponent ) . model }
@@ -280,14 +277,9 @@ class VueComponentLoader extends React.Component {
280
277
this . getNamespaceSlots . __namespaceSlots [ i ] = newSlot
281
278
} else {
282
279
newSlot = this . getNamespaceSlots . __namespaceSlots [ i ]
283
- // 触发通信层更新fiberNode
284
- if ( newSlot [ 0 ] . child . reactInstance ) {
280
+ this . $nextTick ( ( ) => {
285
281
newSlot [ 0 ] . child . reactInstance . setState ( { children : slot } )
286
- } else {
287
- this . $nextTick ( ( ) => {
288
- newSlot [ 0 ] . child . reactInstance . setState ( { children : slot } )
289
- } )
290
- }
282
+ } )
291
283
}
292
284
newSlot . reactSlot = slot
293
285
return newSlot
@@ -318,13 +310,9 @@ class VueComponentLoader extends React.Component {
318
310
} else {
319
311
newSlot = this . getScopedSlots . __scopeSlots [ i ]
320
312
// 触发通信层更新fiberNode
321
- if ( newSlot . child . reactInstance ) {
313
+ this . $nextTick ( ( ) => {
322
314
newSlot . child . reactInstance . setState ( { children : scopedSlot ( context ) } )
323
- } else {
324
- this . $nextTick ( ( ) => {
325
- newSlot . child . reactInstance . setState ( { children : scopedSlot ( context ) } )
326
- } )
327
- }
315
+ } )
328
316
}
329
317
return newSlot
330
318
}
@@ -353,13 +341,9 @@ class VueComponentLoader extends React.Component {
353
341
// Object.assign(this.getChildren.__vnode[0], createElement(applyReactInVue(() => children, {...options, isSlots: true})))
354
342
newSlot = this . getChildren . __vnode
355
343
// 直接修改react的fiberNode,此过程vnode无感知,此方案只是临时
356
- if ( newSlot [ 0 ] . child . reactInstance ) {
344
+ this . $nextTick ( ( ) => {
357
345
newSlot [ 0 ] . child . reactInstance . setState ( { children } )
358
- } else {
359
- this . $nextTick ( ( ) => {
360
- newSlot [ 0 ] . child . reactInstance . setState ( { children } )
361
- } )
362
- }
346
+ } )
363
347
}
364
348
newSlot . reactSlot = children
365
349
return newSlot
0 commit comments