VUE2.6.10——Vueオブジェクト


  • /src/core/index.js
  • /src/core/instance/index.js
  • function Vue (options) {
      if (process.env.NODE_ENV !== 'production' &&
        !(this instanceof Vue)
      ) {
        warn('Vue is a constructor and should be called with the `new` keyword')
      }
      this._init(options)  
    }
    /*
    *    Vue.prototype._init
    */
    initMixin(Vue)      
    /*
    *     Object.defineProperty(Vue.prototype, '$data', dataDef)
    *     Object.defineProperty(Vue.prototype, '$props', propsDef)
    *     Vue.prototype.$set = set
    *     Vue.prototype.$delete = del
    *     Vue.prototype.$watch
    */
    stateMixin(Vue)   
    /*
    *    Vue.prototype.$on
    *    Vue.prototype.$once
    *    Vue.prototype.$off
    *    Vue.prototype.$emit
    */
    eventsMixin(Vue)        
    /*
    *    Vue.prototype._update
    *    Vue.prototype.$forceUpdate
    *    Vue.prototype.$destroy
    */
    lifecycleMixin(Vue)    
    /*
    *    RenderHelpers...
    *    Vue.prototype.$nextTick
    *    Vue.prototype._render
    */
    renderMixin(Vue)      

    Vue.prototype._init
    initLifecycle(vm)   //   init          parent $children 
    initEvents(vm) // _events      
    initRender(vm)  //defineReactive  $attrs $listeners
    callHook(vm, 'beforeCreate')   //    
    initInjections(vm) // provide   inject        /       。               。
    initState(vm)  // initProps、initMethods、initData、initComputed
    initProvide(vm) // resolve provide after data/props
    callHook(vm, 'created')
    
    vm.$mount  //vm._render -> _update   
    

    サイクルフックの宣言
    beforeCreate -> created -> beforeMount -> mounted
    

    参考資料
    Vue provide/inject