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
  27e71f35_12fd_58cc_25d7_c5686da5aaf6["initMixin()"]
  ae790ceb_073b_1bcf_331c_af2d587c1ad6["init.ts"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|defined in| ae790ceb_073b_1bcf_331c_af2d587c1ad6
  52e70123_85d8_4258_eaf3_a7a0731a5968["mark()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| 52e70123_85d8_4258_eaf3_a7a0731a5968
  5d785ff9_51ea_51b2_43cb_49d96c279d39["initInternalComponent()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| 5d785ff9_51ea_51b2_43cb_49d96c279d39
  26b4ac68_6ee7_2ffb_30a9_a112563a125f["resolveConstructorOptions()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| 26b4ac68_6ee7_2ffb_30a9_a112563a125f
  8456f6f9_fac5_bded_b12e_00d134623933["initProxy()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| 8456f6f9_fac5_bded_b12e_00d134623933
  1b5974c6_1385_a2dc_0c7c_8cc8c4210866["initLifecycle()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| 1b5974c6_1385_a2dc_0c7c_8cc8c4210866
  b5467571_ff24_3513_9196_5f6c9ff68844["initEvents()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| b5467571_ff24_3513_9196_5f6c9ff68844
  bdbcb4df_444f_38c6_ba9d_20ef23f9091f["initRender()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| bdbcb4df_444f_38c6_ba9d_20ef23f9091f
  77ac8989_609a_4755_79eb_0403c1cc7788["callHook()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| 77ac8989_609a_4755_79eb_0403c1cc7788
  45112b4b_136f_4ca4_9b54_39184304d055["initInjections()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| 45112b4b_136f_4ca4_9b54_39184304d055
  ff5d1d58_05a4_1c98_682b_8814ac1fe9fd["initState()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| ff5d1d58_05a4_1c98_682b_8814ac1fe9fd
  68bbfc64_1294_f17d_704a_8b362d3aa642["initProvide()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| 68bbfc64_1294_f17d_704a_8b362d3aa642
  51edb677_f952_7062_365b_064cd93a29f4["measure()"]
  27e71f35_12fd_58cc_25d7_c5686da5aaf6 -->|calls| 51edb677_f952_7062_365b_064cd93a29f4
  style 27e71f35_12fd_58cc_25d7_c5686da5aaf6 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