Skip to content

Commit cf95c90

Browse files
committed
将react实例的可枚举属性挂到vue实例中
1 parent 2527f06 commit cf95c90

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/applyReactInVue.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ const createReactContainer = (Component, options, wrapInstance) => class applyRe
2727
if (!ref) return
2828
// 使用reactRef属性保存目标react组件的实例,可以被父组setRef件的实例获取到
2929
wrapInstance.reactRef = ref
30+
// 将react实例的可枚举属性挂到vue实例中
31+
Object.keys(ref).forEach((key) => {
32+
if (!wrapInstance[key]) {
33+
wrapInstance[key] = ref[key]
34+
}
35+
})
3036

3137
// 兼容接收useRef类型的参数
3238
this.setRef.current = ref

0 commit comments

Comments
 (0)