feat(transition): compat with keep-alive
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { ComponentInternalInstance, currentInstance } from './component'
|
||||
import { VNode, NormalizedChildren, normalizeVNode, VNodeChild } from './vnode'
|
||||
import { isArray, isFunction } from '@vue/shared'
|
||||
import { isArray, isFunction, EMPTY_OBJ } from '@vue/shared'
|
||||
import { ShapeFlags } from './shapeFlags'
|
||||
import { warn } from './warning'
|
||||
import { isKeepAlive } from './components/KeepAlive'
|
||||
|
||||
export type Slot = (...args: any[]) => VNode[]
|
||||
|
||||
@@ -65,7 +66,7 @@ export function resolveSlots(
|
||||
}
|
||||
} else if (children !== null) {
|
||||
// non slot object children (direct value) passed to a component
|
||||
if (__DEV__) {
|
||||
if (__DEV__ && !isKeepAlive(instance.vnode)) {
|
||||
warn(
|
||||
`Non-function value encountered for default slot. ` +
|
||||
`Prefer function slots for better performance.`
|
||||
@@ -74,7 +75,5 @@ export function resolveSlots(
|
||||
const normalized = normalizeSlotValue(children)
|
||||
slots = { default: () => normalized }
|
||||
}
|
||||
if (slots !== void 0) {
|
||||
instance.slots = slots
|
||||
}
|
||||
instance.slots = slots || EMPTY_OBJ
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user