惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
P
Palo Alto Networks Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
L
LINUX DO - 热门话题
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
Cisco Talos Blog
Cisco Talos Blog
AI
AI
L
LINUX DO - 最新话题
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
Webroot Blog
Webroot Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The GitHub Blog
The GitHub Blog
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
S
Securelist
博客园_首页
IT之家
IT之家
Schneier on Security
Schneier on Security
博客园 - 叶小钗
罗磊的独立博客
WordPress大学
WordPress大学
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
W
WeLiveSecurity
The Register - Security
The Register - Security
D
DataBreaches.Net
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
Recorded Future
Recorded Future
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tailwind CSS Blog
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
T
Tor Project blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com

博客园 - 草珊瑚

前端git开发分支各种场景管理 RxJS Subject学习 微信小程序登陆流程(20200322) eggjs2.x版本异步获取config配置方案 - 草珊瑚 - 博客园 dubbo连接过程 计算机中对流的理解 Egg.js运行环境配置场景 Promise和Observable的映射 eggjs异常捕获机制 极客时间数据结构与算法之美笔记7 JS项目快速压缩(windows平台) - 草珊瑚 - 博客园 JS项目快速压缩(windows平台) - 草珊瑚 - 博客园 Maven工程的POM继承 Docker构建一个node镜像 win10家庭版安装Docker for Windows linux,vim和bash命令小册 vue文档阅读笔记——计算属性和侦听器 nodejs的jekins部署 `vue-router`的`History`模式下的项目发布
vue依赖收集的策略
草珊瑚 · 2020-02-27 · via 博客园 - 草珊瑚

依赖收集的策略

遍历dom节点,找到正则匹配的{{}}所在节点,执行$watch方法。

$watch方法传入两个参数:
1.绑定的数据路径
2.回调函数
回调函数包含了对应的节点信息。

$watch方法的实现:
生成一个Watcher实例,用于收集依赖。
然后就把Watcher实例放入全局target。
依赖收集的方式是,访问object数据,从而触发get方法。
get方法里判断有全局的target,执行Dep实例的addDepend方法。
addDepend方法内容:全局target也就是Watcher实例执行addDep方法。
addDep方法内容:把Watcher实例放入Dep实例的数组中。
完成依赖收集。

参考:
https://github.com/muwoo/wue