Home / Function/ initMixin() — vue Function Reference

initMixin() — vue Function Reference

Architecture documentation for the initMixin() function in init.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  7cb38e61_0473_03dc_2a46_4308c941e8cf["initMixin()"]
  9e587547_0a20_aaaa_ba5c_6103ca27ef79["init.ts"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|defined in| 9e587547_0a20_aaaa_ba5c_6103ca27ef79
  c66f2b7c_7247_ba1e_a44e_c9fbf576a0f8["mark()"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|calls| c66f2b7c_7247_ba1e_a44e_c9fbf576a0f8
  e536f7fa_3203_b3e0_5782_32edd9f85b74["initInternalComponent()"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|calls| e536f7fa_3203_b3e0_5782_32edd9f85b74
  5cf3f4c3_fa41_407a_5974_78bd867200bd["resolveConstructorOptions()"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|calls| 5cf3f4c3_fa41_407a_5974_78bd867200bd
  28312ac3_ad7f_97ae_dcab_e5134fb1881f["initProxy()"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|calls| 28312ac3_ad7f_97ae_dcab_e5134fb1881f
  82b26b02_c18b_b13d_066b_5fc68534d307["initLifecycle()"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|calls| 82b26b02_c18b_b13d_066b_5fc68534d307
  0641f0aa_39b1_9512_4e37_1f438403b4c0["initEvents()"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|calls| 0641f0aa_39b1_9512_4e37_1f438403b4c0
  f4a31343_8d36_5571_8c89_ce5e074a5044["initRender()"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|calls| f4a31343_8d36_5571_8c89_ce5e074a5044
  f8064a1e_1b6a_274a_f334_111faf594604["callHook()"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|calls| f8064a1e_1b6a_274a_f334_111faf594604
  3204874f_4db2_0342_a8fc_5a37bc2a2832["initInjections()"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|calls| 3204874f_4db2_0342_a8fc_5a37bc2a2832
  ceeb400a_fb7f_c638_1feb_8311db20c105["initState()"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|calls| ceeb400a_fb7f_c638_1feb_8311db20c105
  1bb0dfc1_ba33_9985_3c49_d442c6b33c25["initProvide()"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|calls| 1bb0dfc1_ba33_9985_3c49_d442c6b33c25
  3dba2c58_eaa7_9043_7b9a_5564624e9333["measure()"]
  7cb38e61_0473_03dc_2a46_4308c941e8cf -->|calls| 3dba2c58_eaa7_9043_7b9a_5564624e9333
  style 7cb38e61_0473_03dc_2a46_4308c941e8cf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/core/instance/init.ts lines 16–82

export function initMixin(Vue: typeof Component) {
  Vue.prototype._init = function (options?: Record<string, any>) {
    const vm: Component = this
    // a uid
    vm._uid = uid++

    let startTag, endTag
    /* istanbul ignore if */
    if (__DEV__ && config.performance && mark) {
      startTag = `vue-perf-start:${vm._uid}`
      endTag = `vue-perf-end:${vm._uid}`
      mark(startTag)
    }

    // a flag to mark this as a Vue instance without having to do instanceof
    // check
    vm._isVue = true
    // avoid instances from being observed
    vm.__v_skip = true
    // effect scope
    vm._scope = new EffectScope(true /* detached */)
    // #13134 edge case where a child component is manually created during the
    // render of a parent component
    vm._scope.parent = undefined
    vm._scope._vm = true
    // merge options
    if (options && options._isComponent) {
      // optimize internal component instantiation
      // since dynamic options merging is pretty slow, and none of the
      // internal component options needs special treatment.
      initInternalComponent(vm, options as any)
    } else {
      vm.$options = mergeOptions(
        resolveConstructorOptions(vm.constructor as any),
        options || {},
        vm
      )
    }
    /* istanbul ignore else */
    if (__DEV__) {
      initProxy(vm)
    } else {
      vm._renderProxy = vm
    }
    // expose real self
    vm._self = vm
    initLifecycle(vm)
    initEvents(vm)
    initRender(vm)
    callHook(vm, 'beforeCreate', undefined, false /* setContext */)
    initInjections(vm) // resolve injections before data/props
    initState(vm)
    initProvide(vm) // resolve provide after data/props
    callHook(vm, 'created')

    /* istanbul ignore if */
    if (__DEV__ && config.performance && mark) {
      vm._name = formatComponentName(vm, false)
      mark(endTag)
      measure(`vue ${vm._name} init`, startTag, endTag)
    }

    if (vm.$options.el) {
      vm.$mount(vm.$options.el)
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does initMixin() do?
initMixin() is a function in the vue codebase, defined in src/core/instance/init.ts.
Where is initMixin() defined?
initMixin() is defined in src/core/instance/init.ts at line 16.
What does initMixin() call?
initMixin() calls 12 function(s): callHook, initEvents, initInjections, initInternalComponent, initLifecycle, initProvide, initProxy, initRender, and 4 more.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free