![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Vue
amurocrash
这个作者很懒,什么都没留下…
展开
-
读源码(六)—— Vue响应式
例子: <template> <div id="app"> <img src="../assets/logo.png"> <div v-if="flag"> {{msg}} </div> <div v-else> {{msg1}} </div> <button @click="change">change</button>原创 2020-12-19 22:53:34 · 180 阅读 · 0 评论 -
读源码(五)—— new Vue
标准Vue HelloWorld的例子(内容简化): // main.js new Vue({ el: '#app', render: h => h(App) }) // App.vue <template> <div id="app"> <img src="./assets/logo.png"> <hello-world></hello-world> </div> </template&g原创 2020-12-15 10:59:05 · 105 阅读 · 0 评论 -
自己写代码理解Vue的数据双向绑定
重要代码的作用都写在代码注释中了。 核心点: 1、Object.defineProperty(),相当于给相关属性在取值和赋值时增加proxy,可以执行proxy中的功能,这里就是在get是进行双向绑定 2、Compiler的本质就是遍历html文档,把按照vue规范定的字段找出来做处理。比如{{deep.a}}取出来之后,从vm实例中拿出真实的值把{{deep.a}}替换掉。 <!DOCT...原创 2020-02-14 13:11:14 · 155 阅读 · 0 评论