initVue - 源碼筆記

1、源碼斷點入口

package.json (main & module) or webpack config resolve alias get entry file

vue-cli init project runtime-compiler version entry node_modules/vue/dist/vue.esm.js

vue-cli init project runtime-only version entry node_modules/vue/dist/vue.runtime.esm.js

2、initVue 主流程

mergeOptions: normalizeProps normalizeInject normalizeDirectives

initProxy: vm._renderProxy = new Proxy(vm, handlers)

initLifecycle: $childern $root $parent $refs _watcher _inactive _direcInactive _isMounted _isDestroyed _isBeingDestoryed

initEvents: _event _hasHookEvent updateComponentListeners()

initRender: _vnode $slots $scopedSlots _c = $createElement $attrs $listeners

callHook(vm, 'beforeCreate')

initInjections: provide => inject => date

initState: initProps initMethods initData initComputed initWatch

initProvide: _provided

callHook(vm, 'created')

$mount()

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章