Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$add problem #873

Closed
butsalt opened this issue May 28, 2015 · 3 comments
Closed

$add problem #873

butsalt opened this issue May 28, 2015 · 3 comments

Comments

@butsalt
Copy link

butsalt commented May 28, 2015

<div id="app"></div>
<div id="app2"></div>
var Vue = require("vue");

var data = global.data = {
    foo: {
        bar: "something"
    }
};

var app = global.app = new Vue({
    data: data,
    template: "<div>{{foo.bar}}</div><div>{{foo.bao}}</div>"
}).$mount("#app");

var app2 = global.app2 = new Vue({
    data: data.foo,
    template: "<div>{{bar}}</div>"
}).$mount("#app2");

Then I invoke $add in console

data.foo.$add("bao","koo")

Nothing happened.
I think that might because data.foo has been observed as app2's root $data. So when I invoke $add, it is helpfull with app2, but it will not trigger the deps that on data.foo.

@OEvgeny
Copy link

OEvgeny commented May 28, 2015

Yes, seems not work correctly. Fiddle for this http://jsfiddle.net/Lh6h0Ly0/

@azamat-sharapov
Copy link

So app.$add('bao', 'koo') won't work for you case?

@azamat-sharapov
Copy link

Actually it should be data.$add('foo.bao', 'koo') instead of data.foo.$add('bao', 'koo').

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants