I have this list:
<ul id="tab">
<li v-for="list in names">
{{ list.personName }}
</li>
</ul>
And then I have this vue object:
var vm = new Vue ({
el: '#tab',
data: {
names: //an object array coming from the server
}
});
So the 'names' data is updated and given information from the server. However, when the names are updated/change, it is not reflected on the client side list. The items that appear in the list only reflect the items that were there when the page initially loaded.
In the vue.js developer tools in Google Chrome, I can always see the updated 'names' data, but it just doesn't reflect on the DOM itself.
EDIT1: What's in the 'name's:
names: Array[2]
0: Object
_id: "580aeafd017fbfb81a3a794d"
personName: "hi"
1: Object
_id: "580c4455ccc9e39c21f02434"
personName: "test"
EDIT2
So I'm using node.js, and transferring the data live from node to the client via socket.io like this:
socket.on('userDocument', function(userDocument) {
var vm= new Vue ({
el: '#tab',
data: {
names: //an object array coming from the server
}
});
});
namesin the component?vue-resourceto do that work for you? Can you show that part of code? It helps because there might be a potential issue with binding ofthisin the Promise handlers.console.log()before getting to Vue? You may want to add socket.io tag also. Nevertheless, I have written my answer below, check it out.console.log. The message is in my EDIT1