所有文章会不持续更新
banama / aboutvue Goto Github PK
View Code? Open in Web Editor NEWVue源码解读和分析
Vue源码解读和分析
hi, banama:
我看了你的这篇文章,收获良多,谢谢!
但是,有一些地方我没有想明白。
1. 为什么Vue要使用状态机来解析path路径?
比如你在文章中举的例子
var a = {
b: {
c: {
d: "e"
}
}
}
var path = "b.c.d"
如果仅仅是想得到path路径对应的值,那么直接根据path拼接一个新的Function不是一个更简单的方法吗?示意代码如下:
new Function(scope){
return scope.b.c.d
}
这也是Vue源码中makeGetterFn函数所干的事情。
所以,使用状态机解析path有什么特别的优势吗?
2. 如何触发状态机
我自己做的例子是这样的:
<div id="demo">
<p>{{user.info[1].name}}</p>
<p>{{user.age}}</p>
</div>
但是发现整个程序执行下来,根本不会触发parse/path.js里面的parsePath函数,更加谈不上使用状态机解析path路径了。
相反,程序触发的是parse/expression.js里面的parseExpression函数。
我想知道要**怎样编写demo才能触发parse/path.js里面的parsePath函数呢?**因为不触发它,我根本没有办法debug状态机这一部分的代码。
如题
issuse --> issue
vue-observe.md
当 vm.model 发生改变时,model 的 getter 方法将会向其所有的订阅者发送消息
此描述有误,应该是
当 vm.model 发生改变时,model 的 setter 方法将会向其所有的订阅者发送消息
请问一下,vue为什么需要合并父子组件的data?既然合并了所有组件的data,那么为什么我不能在父组件访问到子组件的data
如果有提问,会回答吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.