enter() — vue Function Reference
Architecture documentation for the enter() function in transition.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD b003e13b_30f4_2501_b631_df864fa7941b["enter()"] e3f0dcd1_5331_9983_ee74_98651c6009f3["default.bind()"] e3f0dcd1_5331_9983_ee74_98651c6009f3 -->|calls| b003e13b_30f4_2501_b631_df864fa7941b 394714aa_8288_0f42_8564_08fb679a1d9f["default.update()"] 394714aa_8288_0f42_8564_08fb679a1d9f -->|calls| b003e13b_30f4_2501_b631_df864fa7941b 85effaf2_5218_25e3_2f24_f46958f7112c["_enter()"] 85effaf2_5218_25e3_2f24_f46958f7112c -->|calls| b003e13b_30f4_2501_b631_df864fa7941b 2be3818d_a4f3_495c_543c_ee071b428982["isDef()"] b003e13b_30f4_2501_b631_df864fa7941b -->|calls| 2be3818d_a4f3_495c_543c_ee071b428982 42f54d00_63e8_6550_8a02_9676b3f014dd["resolveTransition()"] b003e13b_30f4_2501_b631_df864fa7941b -->|calls| 42f54d00_63e8_6550_8a02_9676b3f014dd a1f5b8ca_b6d5_6b24_155e_038685c97c85["isUndef()"] b003e13b_30f4_2501_b631_df864fa7941b -->|calls| a1f5b8ca_b6d5_6b24_155e_038685c97c85 5af21a52_5316_e857_22eb_dce69bb60268["isFunction()"] b003e13b_30f4_2501_b631_df864fa7941b -->|calls| 5af21a52_5316_e857_22eb_dce69bb60268 d2f853c8_874e_b299_f3cc_cc451ad45eea["toNumber()"] b003e13b_30f4_2501_b631_df864fa7941b -->|calls| d2f853c8_874e_b299_f3cc_cc451ad45eea 2d184c1f_e247_ef28_44f9_122886cfd2a5["isObject()"] b003e13b_30f4_2501_b631_df864fa7941b -->|calls| 2d184c1f_e247_ef28_44f9_122886cfd2a5 ab290258_9761_9c78_cb21_a18b70c9dafd["checkDuration()"] b003e13b_30f4_2501_b631_df864fa7941b -->|calls| ab290258_9761_9c78_cb21_a18b70c9dafd f8796a4d_0b93_c2df_44b2_78106ba2d82c["getHookArgumentsLength()"] b003e13b_30f4_2501_b631_df864fa7941b -->|calls| f8796a4d_0b93_c2df_44b2_78106ba2d82c f1f4b24d_509b_4634_bd6a_d3b0e91f0b48["once()"] b003e13b_30f4_2501_b631_df864fa7941b -->|calls| f1f4b24d_509b_4634_bd6a_d3b0e91f0b48 90afa8b0_bab8_d609_1928_b82464e9f59a["removeTransitionClass()"] b003e13b_30f4_2501_b631_df864fa7941b -->|calls| 90afa8b0_bab8_d609_1928_b82464e9f59a 8604834e_72c7_6a5f_2bab_e07b77f57174["addTransitionClass()"] b003e13b_30f4_2501_b631_df864fa7941b -->|calls| 8604834e_72c7_6a5f_2bab_e07b77f57174 style b003e13b_30f4_2501_b631_df864fa7941b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/platforms/web/runtime/modules/transition.ts lines 25–167
export function enter(vnode: VNodeWithData, toggleDisplay?: () => void) {
const el: any = vnode.elm
// call leave callback now
if (isDef(el._leaveCb)) {
el._leaveCb.cancelled = true
el._leaveCb()
}
const data = resolveTransition(vnode.data.transition)
if (isUndef(data)) {
return
}
/* istanbul ignore if */
if (isDef(el._enterCb) || el.nodeType !== 1) {
return
}
const {
css,
type,
enterClass,
enterToClass,
enterActiveClass,
appearClass,
appearToClass,
appearActiveClass,
beforeEnter,
enter,
afterEnter,
enterCancelled,
beforeAppear,
appear,
afterAppear,
appearCancelled,
duration
} = data
// activeInstance will always be the <transition> component managing this
// transition. One edge case to check is when the <transition> is placed
// as the root node of a child component. In that case we need to check
// <transition>'s parent for appear check.
let context = activeInstance
let transitionNode = activeInstance.$vnode
while (transitionNode && transitionNode.parent) {
context = transitionNode.context
transitionNode = transitionNode.parent
}
const isAppear = !context._isMounted || !vnode.isRootInsert
if (isAppear && !appear && appear !== '') {
return
}
const startClass = isAppear && appearClass ? appearClass : enterClass
const activeClass =
isAppear && appearActiveClass ? appearActiveClass : enterActiveClass
const toClass = isAppear && appearToClass ? appearToClass : enterToClass
const beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter
const enterHook = isAppear ? (isFunction(appear) ? appear : enter) : enter
const afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter
const enterCancelledHook = isAppear
? appearCancelled || enterCancelled
: enterCancelled
const explicitEnterDuration: any = toNumber(
isObject(duration) ? duration.enter : duration
)
if (__DEV__ && explicitEnterDuration != null) {
checkDuration(explicitEnterDuration, 'enter', vnode)
}
const expectsCSS = css !== false && !isIE9
const userWantsControl = getHookArgumentsLength(enterHook)
const cb = (el._enterCb = once(() => {
if (expectsCSS) {
removeTransitionClass(el, toClass)
removeTransitionClass(el, activeClass)
}
// @ts-expect-error
if (cb.cancelled) {
if (expectsCSS) {
removeTransitionClass(el, startClass)
}
enterCancelledHook && enterCancelledHook(el)
} else {
afterEnterHook && afterEnterHook(el)
}
el._enterCb = null
}))
if (!vnode.data.show) {
// remove pending leave element on enter by injecting an insert hook
mergeVNodeHook(vnode, 'insert', () => {
const parent = el.parentNode
const pendingNode =
parent && parent._pending && parent._pending[vnode.key!]
if (
pendingNode &&
pendingNode.tag === vnode.tag &&
pendingNode.elm._leaveCb
) {
pendingNode.elm._leaveCb()
}
enterHook && enterHook(el, cb)
})
}
// start enter transition
beforeEnterHook && beforeEnterHook(el)
if (expectsCSS) {
addTransitionClass(el, startClass)
addTransitionClass(el, activeClass)
nextFrame(() => {
removeTransitionClass(el, startClass)
// @ts-expect-error
if (!cb.cancelled) {
addTransitionClass(el, toClass)
if (!userWantsControl) {
if (isValidDuration(explicitEnterDuration)) {
setTimeout(cb, explicitEnterDuration)
} else {
whenTransitionEnds(el, type, cb)
}
}
}
})
}
if (vnode.data.show) {
toggleDisplay && toggleDisplay()
enterHook && enterHook(el, cb)
}
if (!expectsCSS && !userWantsControl) {
cb()
}
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does enter() do?
enter() is a function in the vue codebase.
What does enter() call?
enter() calls 14 function(s): addTransitionClass, checkDuration, getHookArgumentsLength, isDef, isFunction, isObject, isUndef, isValidDuration, and 6 more.
What calls enter()?
enter() is called by 3 function(s): _enter, default.bind, default.update.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free