| 2375 | var uid = 0; |
| 2376 | |
| 2377 | function initMixin (Vue) { |
| 2378 | /** |
| 2379 | * The main init sequence. This is called for every |
| 2380 | * instance, including ones that are created from extended |
| 2381 | * constructors. |
| 2382 | * |
| 2383 | * @param {Object} options - this options object should be |
| 2384 | * the result of merging class |
| 2385 | * options and the options passed |
| 2386 | * in to the constructor. |
| 2387 | */ |
| 2388 | |
| 2389 | Vue.prototype._init = function (options) { |
| 2390 | options = options || {}; |
| 2391 | |
| 2392 | this.$el = null; |
| 2393 | this.$parent = options.parent; |
| 2394 | this.$root = this.$parent ? this.$parent.$root : this; |
| 2395 | this.$children = []; |
| 2396 | this.$refs = {}; // child vm references |
| 2397 | this.$els = {}; // element references |
| 2398 | this._watchers = []; // all watchers as an array |
| 2399 | this._directives = []; // all directives |
| 2400 | |
| 2401 | // a uid |
| 2402 | this._uid = uid++; |
| 2403 | |
| 2404 | // a flag to avoid this being observed |
| 2405 | this._isVue = true; |
| 2406 | |
| 2407 | // events bookkeeping |
| 2408 | this._events = {}; // registered callbacks |
| 2409 | this._eventsCount = {}; // for $broadcast optimization |
| 2410 | |
| 2411 | // fragment instance properties |
| 2412 | this._isFragment = false; |
| 2413 | this._fragment = // @type {DocumentFragment} |
| 2414 | this._fragmentStart = // @type {Text|Comment} |
| 2415 | this._fragmentEnd = null; // @type {Text|Comment} |
| 2416 | |
| 2417 | // lifecycle state |
| 2418 | this._isCompiled = this._isDestroyed = this._isReady = this._isAttached = this._isBeingDestroyed = this._vForRemoving = false; |
| 2419 | this._unlinkFn = null; |
| 2420 | |
| 2421 | // context: |
| 2422 | // if this is a transcluded component, context |
| 2423 | // will be the common parent vm of this instance |
| 2424 | // and its host. |
| 2425 | this._context = options._context || this.$parent; |
| 2426 | |
| 2427 | // scope: |
| 2428 | // if this is inside an inline v-for, the scope |
| 2429 | // will be the intermediate scope created for this |
| 2430 | // repeat fragment. this is used for linking props |
| 2431 | // and container directives. |
| 2432 | this._scope = options._scope; |
| 2433 | |
| 2434 | // fragment: |