Here is a list I have:
<ul id="tab">
<li v-for="list in names">
{{ list.personName }}
</li>
</ul>
And then, I have this Vue object set up:
var vm = new Vue ({
el: '#tab',
data: {
names: //an object array received from the server
}
});
Even though the 'names' data gets updated and receives information from the server, the changes do not reflect on the client-side list. The list only shows the items that were present when the page initially loaded.
When I check the Vue.js developer tools in Google Chrome, I can see the updated 'names' data, but for some reason, it doesn't show up on the actual DOM.
EDIT1: What's stored in 'names':
names: Array[2]
0: Object
_id: "580aeafd017fbfb81a3a794d"
personName: "hi"
1: Object
_id: "580c4455ccc9e39c21f02434"
personName: "test"
EDIT2
I'm using node.js to transfer live data from the server 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
}
});
});