- Vue 首次渲染的过程。
- 先初始化Vue的实例成员和静态方法
- 调用构造函数,根据模板或用户自己写的render函数生成渲染函数
- 调用beforeMount钩子函数
- 根据渲染函数生成虚拟DOM,再将虚拟DOM转换成真实DOM,挂载到页面上
- 创建Watcher对象,收集依赖,以便将来数据改变时更新视图
- 调用Mounted钩子函数,初始化结束
- Vue 响应式原理
- 通过Object.defineProperty 和 ES6 的 Proxy 对对象类型的数据进行数据劫持,监听数据的变化
- 在getter函数中收集依赖
- 通过发布订阅模式在数据改变,调用setter时,更新视图
- 虚拟 DOM 中 Key 的作用和好处
- 作用:标记Vnode,结合tagName用来判断新旧节点是否是同一节点
- 好处:当更改视图相关数据时,最小化更新视图,性能更好
- Vue 中模板编译的过程
- 将模板字符串转换成AST抽象语法树
- 对AST进行静态节点标记,在后续转化过程中提供优化
- 通过 generate 将 AST 抽象语法树转换为 render 函数的 js 字符串
fed-e-task-part3-02's Introduction
fed-e-task-part3-02's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.