vue v2.5.0源碼-雙向數據綁定

把option.data轉變爲vm._data的可觀察對象

new Vue => this._init() => initState(vm) => initData(vm) => observe(data) => new Observer(data) => walk(data) => defineReactive(obj, key, value) => dep.depend() =>  vue

watcher.addDep(dep) => watcher.newDeps.push(dep),dep.addSub(watcher) => dep.subs.push(watcher) =>dep.notify()git

創建雙向數據綁定

vm.$mount => mountComponent => new Watcher(vm, updateComponent) => updateComponent => render => getter =>創建雙向數據綁定github

 

 

[1]https://blog.seosiwei.com/detail/22this

[2]https://blog.csdn.net/wangweianger/article/details/79826801.net

[3]https://github.com/liutao/vue2.0-source/blob/master/%E5%8F%8C%E5%90%91%E6%95%B0%E6%8D%AE%E7%BB%91%E5%AE%9A.mdserver

相關文章
相關標籤/搜索