let uid = 0; exportfunctioninitMixin(Vue){ Vue.prototype._init = function (options?: Record<string, any>) { constvm: 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 = newEffectScope(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.constructoras 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) } } }
/** * Whether to suppress warnings. */ silent: false,
/** * Show production mode tip message on boot? */ productionTip: __DEV__,
/** * Whether to enable devtools */ devtools: __DEV__,
/** * Whether to record perf */ performance: false,
/** * Error handler for watcher errors */ errorHandler: null,
/** * Warn handler for watcher warns */ warnHandler: null,
/** * Ignore certain custom elements */ ignoredElements: [],
/** * Custom user key aliases for v-on */ // $flow-disable-line keyCodes: Object.create(null),
/** * Check if a tag is reserved so that it cannot be registered as a * component. This is platform-dependent and may be overwritten. */ isReservedTag: no,
/** * Check if an attribute is reserved so that it cannot be used as a component * prop. This is platform-dependent and may be overwritten. */ isReservedAttr: no,
/** * Check if a tag is an unknown element. * Platform-dependent. */ isUnknownElement: no,
/** * Get the namespace of an element */ getTagNamespace: noop,
/** * Parse the real tag name for the specific platform. */ parsePlatformTagName: identity,
/** * Check if an attribute must be bound using property, e.g. value * Platform-dependent. */ mustUseProp: no,
/** * Perform updates asynchronously. Intended to be used by Vue Test Utils * This will significantly reduce performance if set to false. */ async: true,
/** * Exposed for legacy reasons */ _lifecycleHooks: LIFECYCLE_HOOKS } as unknown asConfig