fix(async-component): forward refs on async component wrapper

fix #2671
This commit is contained in:
Evan You
2020-11-30 18:59:14 -05:00
parent 87581cd266
commit 64d4681e4b
4 changed files with 66 additions and 18 deletions

View File

@@ -21,7 +21,7 @@ import {
isClassComponent
} from './component'
import { RawSlots } from './componentSlots'
import { isProxy, Ref, toRaw, ReactiveFlags } from '@vue/reactivity'
import { isProxy, Ref, toRaw, ReactiveFlags, isRef } from '@vue/reactivity'
import { AppContext } from './apiCreateApp'
import {
SuspenseImpl,
@@ -304,9 +304,9 @@ const normalizeKey = ({ key }: VNodeProps): VNode['key'] =>
const normalizeRef = ({ ref }: VNodeProps): VNodeNormalizedRefAtom | null => {
return (ref != null
? isArray(ref)
? ref
: { i: currentRenderingInstance, r: ref }
? isString(ref) || isRef(ref) || isFunction(ref)
? { i: currentRenderingInstance, r: ref }
: ref
: null) as any
}