lifecycleMixin() — vue Function Reference
Architecture documentation for the lifecycleMixin() function in lifecycle.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD c645c33d_8908_2339_67bb_0680e222abf8["lifecycleMixin()"] 42d899bd_4180_740d_cb17_22e7258ff665["setActiveInstance()"] c645c33d_8908_2339_67bb_0680e222abf8 -->|calls| 42d899bd_4180_740d_cb17_22e7258ff665 59e4bdf1_7b9a_0d0a_248e_ef175bec51af["update()"] c645c33d_8908_2339_67bb_0680e222abf8 -->|calls| 59e4bdf1_7b9a_0d0a_248e_ef175bec51af 71c7a5aa_6619_7aea_6a94_630a0527f309["callHook()"] c645c33d_8908_2339_67bb_0680e222abf8 -->|calls| 71c7a5aa_6619_7aea_6a94_630a0527f309 6ca6a143_adc5_e094_3874_450907823868["remove()"] c645c33d_8908_2339_67bb_0680e222abf8 -->|calls| 6ca6a143_adc5_e094_3874_450907823868 1323efd8_8b49_c7fc_a4a9_dcd8aeed5387["stop()"] c645c33d_8908_2339_67bb_0680e222abf8 -->|calls| 1323efd8_8b49_c7fc_a4a9_dcd8aeed5387 bfd6b951_4b89_e2ff_4d8d_ccd69b3f2f85["off()"] c645c33d_8908_2339_67bb_0680e222abf8 -->|calls| bfd6b951_4b89_e2ff_4d8d_ccd69b3f2f85 style c645c33d_8908_2339_67bb_0680e222abf8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/instance/lifecycle.ts lines 62–145
export function lifecycleMixin(Vue: typeof Component) {
Vue.prototype._update = function (vnode: VNode, hydrating?: boolean) {
const vm: Component = this
const prevEl = vm.$el
const prevVnode = vm._vnode
const restoreActiveInstance = setActiveInstance(vm)
vm._vnode = vnode
// Vue.prototype.__patch__ is injected in entry points
// based on the rendering backend used.
if (!prevVnode) {
// initial render
vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */)
} else {
// updates
vm.$el = vm.__patch__(prevVnode, vnode)
}
restoreActiveInstance()
// update __vue__ reference
if (prevEl) {
prevEl.__vue__ = null
}
if (vm.$el) {
vm.$el.__vue__ = vm
}
// if parent is an HOC, update its $el as well
let wrapper: Component | undefined = vm
while (
wrapper &&
wrapper.$vnode &&
wrapper.$parent &&
wrapper.$vnode === wrapper.$parent._vnode
) {
wrapper.$parent.$el = wrapper.$el
wrapper = wrapper.$parent
}
// updated hook is called by the scheduler to ensure that children are
// updated in a parent's updated hook.
}
Vue.prototype.$forceUpdate = function () {
const vm: Component = this
if (vm._watcher) {
vm._watcher.update()
}
}
Vue.prototype.$destroy = function () {
const vm: Component = this
if (vm._isBeingDestroyed) {
return
}
callHook(vm, 'beforeDestroy')
vm._isBeingDestroyed = true
// remove self from parent
const parent = vm.$parent
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
remove(parent.$children, vm)
}
// teardown scope. this includes both the render watcher and other
// watchers created
vm._scope.stop()
// remove reference from data ob
// frozen object may not have observer.
if (vm._data.__ob__) {
vm._data.__ob__.vmCount--
}
// call the last hook...
vm._isDestroyed = true
// invoke destroy hooks on current rendered tree
vm.__patch__(vm._vnode, null)
// fire destroyed hook
callHook(vm, 'destroyed')
// turn off all instance listeners.
vm.$off()
// remove __vue__ reference
if (vm.$el) {
vm.$el.__vue__ = null
}
// release circular reference (#6759)
if (vm.$vnode) {
vm.$vnode.parent = null
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does lifecycleMixin() do?
lifecycleMixin() is a function in the vue codebase.
What does lifecycleMixin() call?
lifecycleMixin() calls 6 function(s): callHook, off, remove, setActiveInstance, stop, update.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free