MiniVue:手写实现Mini版Vue

时间:2021-05-22 21:51:12
【文件属性】:
文件名称:MiniVue:手写实现Mini版Vue
文件大小:35KB
文件格式:ZIP
更新时间:2021-05-22 21:51:12
JavaScript MiniVue 手写实现Mini版Vue 实现过程: 发布订阅的关键步骤 这里发布订阅触发的前后步骤:从MVue里开始 new Observer 的时候给所有数据绑定了 getter/setter,同时每一层数据 data 都有一个 dep 实例 new Compile 的时候编译节点触发 compileUtil 里 执行 new Watcher new Watcher 里的 getOldVal 先 Dep.target = this,把 wathcer 自身绑到 Dep 类上,然后调用 compileUtil.getVal getVal 里有操作 data[curVal] ,会触发这个 data[curVal] 的 getter getter 里判断执行 Dep.target && dep.addSub(Dep.target) 【Dep.target 的值第3步加上的】,这样 dep 实
【文件预览】:
MiniVue-master
----Observer.js(3KB)
----CompileUtil.js(3KB)
----MiniVue.js(854B)
----pic()
--------pic1.png(27KB)
----index.html(1KB)
----Compile.js(4KB)
----README.md(2KB)

网友评论