MCPcopy
hub / github.com/vuejs/core / beforeEnter

Function beforeEnter

packages/runtime-core/src/components/BaseTransition.ts:385–409  ·  view source on GitHub ↗
(el)

Source from the content-addressed store, hash-verified

383 mode,
384 persisted,
385 beforeEnter(el) {
386 let hook = onBeforeEnter
387 if (!state.isMounted) {
388 if (appear) {
389 hook = onBeforeAppear || onBeforeEnter
390 } else {
391 return
392 }
393 }
394 // for same element (v-show)
395 if (el[leaveCbKey]) {
396 el[leaveCbKey](true /* cancelled */)
397 }
398 // for toggled element with same key (v-if)
399 const leavingVNode = leavingVNodesCache[key]
400 if (
401 leavingVNode &&
402 isSameVNodeType(vnode, leavingVNode) &&
403 (leavingVNode.el as TransitionElement)[leaveCbKey]
404 ) {
405 // force early removal (not cancelled)
406 ;(leavingVNode.el as TransitionElement)[leaveCbKey]!()
407 }
408 callHook(hook, [el])
409 },
410
411 enter(el) {
412 // prevent enter if leave is in progress

Callers

nothing calls this directly

Calls 2

isSameVNodeTypeFunction · 0.90
callHookFunction · 0.70

Tested by

no test coverage detected