feat(transition): base transition component

This commit is contained in:
Evan You
2019-11-20 18:04:44 -05:00
parent f7009d58a3
commit 93561b080e
6 changed files with 310 additions and 31 deletions

View File

@@ -39,6 +39,9 @@ export interface KeepAliveSink {
deactivate: (vnode: VNode) => void
}
export const isKeepAlive = (vnode: VNode): boolean =>
(vnode.type as any).__isKeepAlive
const KeepAliveImpl = {
name: `KeepAlive`,
@@ -47,6 +50,12 @@ const KeepAliveImpl = {
// would prevent it from being tree-shaken.
__isKeepAlive: true,
props: {
include: [String, RegExp, Array],
exclude: [String, RegExp, Array],
max: [String, Number]
},
setup(props: KeepAliveProps, { slots }: SetupContext) {
const cache: Cache = new Map()
const keys: Keys = new Set()
@@ -200,14 +209,6 @@ const KeepAliveImpl = {
}
}
if (__DEV__) {
;(KeepAliveImpl as any).props = {
include: [String, RegExp, Array],
exclude: [String, RegExp, Array],
max: [String, Number]
}
}
// export the public type for h/tsx inference
export const KeepAlive = (KeepAliveImpl as any) as {
new (): {