GithubHelp home page GithubHelp logo

aboutvue's Issues

Vue使用状态机解析path路径的疑问

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状态机这一部分的代码。

请教

请问一下,vue为什么需要合并父子组件的data?既然合并了所有组件的data,那么为什么我不能在父组件访问到子组件的data

描述错误

vue-observe.md

当 vm.model 发生改变时,model 的 getter 方法将会向其所有的订阅者发送消息

此描述有误,应该是

当 vm.model 发生改变时,model 的 setter 方法将会向其所有的订阅者发送消息

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.