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
  340c5746_ff29_c74c_9da5_50db2db76e5f["initMixin()"]
  e0077606_be30_481a_4b40_50a71251ed9f["mark()"]
  340c5746_ff29_c74c_9da5_50db2db76e5f -->|calls| e0077606_be30_481a_4b40_50a71251ed9f
  cc8134ee_5d2b_e63d_3141_ffd3dea5e78b["initInternalComponent()"]
  340c5746_ff29_c74c_9da5_50db2db76e5f -->|calls| cc8134ee_5d2b_e63d_3141_ffd3dea5e78b
  ede91bbf_a756_b9f6_cf8b_d5c2bb618503["resolveConstructorOptions()"]
  340c5746_ff29_c74c_9da5_50db2db76e5f -->|calls| ede91bbf_a756_b9f6_cf8b_d5c2bb618503
  4beebd0a_7fb4_9587_27ff_2a0e6d712226["initProxy()"]
  340c5746_ff29_c74c_9da5_50db2db76e5f -->|calls| 4beebd0a_7fb4_9587_27ff_2a0e6d712226
  1e92a781_739b_6a1f_17ca_21200c28fd89["initLifecycle()"]
  340c5746_ff29_c74c_9da5_50db2db76e5f -->|calls| 1e92a781_739b_6a1f_17ca_21200c28fd89
  297f9aee_5413_08c8_7b36_7fb9aade39ef["initEvents()"]
  340c5746_ff29_c74c_9da5_50db2db76e5f -->|calls| 297f9aee_5413_08c8_7b36_7fb9aade39ef
  e088d580_2e3e_9093_295c_70dc92327b67["initRender()"]
  340c5746_ff29_c74c_9da5_50db2db76e5f -->|calls| e088d580_2e3e_9093_295c_70dc92327b67
  71c7a5aa_6619_7aea_6a94_630a0527f309["callHook()"]
  340c5746_ff29_c74c_9da5_50db2db76e5f -->|calls| 71c7a5aa_6619_7aea_6a94_630a0527f309
  1dadabb5_0ac6_f33d_3f06_a8220ba63554["initInjections()"]
  340c5746_ff29_c74c_9da5_50db2db76e5f -->|calls| 1dadabb5_0ac6_f33d_3f06_a8220ba63554
  7d6ab8ef_bd4c_49b2_1b21_a805de50af72["initState()"]
  340c5746_ff29_c74c_9da5_50db2db76e5f -->|calls| 7d6ab8ef_bd4c_49b2_1b21_a805de50af72
  8a6e2a59_62cd_9de3_1e9c_dae6bffeba9c["initProvide()"]
  340c5746_ff29_c74c_9da5_50db2db76e5f -->|calls| 8a6e2a59_62cd_9de3_1e9c_dae6bffeba9c
  b699afe1_c2e5_457d_134c_af2c17664385["measure()"]
  340c5746_ff29_c74c_9da5_50db2db76e5f -->|calls| b699afe1_c2e5_457d_134c_af2c17664385
  style 340c5746_ff29_c74c_9da5_50db2db76e5f 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.
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