I am using Vue for the first time, and am confused about why one of my Vue objects keeps updating when the data changes, and the other Vue object won't.
I have a JavaScript module like this to basically just hold data:
var MyModule = (function(){
const info = {
requestCount: 20,
arrayOfItems: []
}
return info;
})();
I have this html:
<span id='requestCounter' class='badge'>{{count}}</span>
<table id='vueTable'><tr v-for="item in items"><td>{{item.description}}</td></tr></table>
And lastly, I have this JavaScript file to do everything:
window.onload = function(){
var mainTable = new Vue({
el: '#vueTable',
data: {
items: MyModule.arrayOfItems
}
});
var requestCounterVue = new Vue({
el: '#requestCounter',
data: {
count: MyModule.requestCount
}
});
}
On the first runthrough, everything works as intended. Changing the MyModule.arrayOfItems works correctly, the table updates depending on what is in the array. However, changing MyModule.requestCount doesn't do anything. Can anybody tell me what I'm doing wrong here?
(Note, my example is simplified to make my question easier)