I have a count
You have {{ keywordsLeft }} keywords left
and in my Vue.
var u = new Vue({
el:'#app',
data:{
keywords:keywords,
user:user,
total_keywords:user.total_keywords,
},
computed: {
keywordsLeft: function () {
var left = total_keywords-keywords.length;
if(left<=0){
return 0;
} else {
return left;
}
}
},
methods: {
deleteKeyword: function(keyword){
var i = this.keywords.indexOf(keyword);
this.keywords.splice(i,1);
}
}
// rest of VUE code.
Whenever an update is made to the data, the computed value doesnt update. I have to refresh the page to do it. I thought the purpose of computed property was live reactivity? Am I missing something?
Do I need to explicitly update it somehow? recompute is manually? Forgive me if Im being stupid, but this seems like a waste if its not done automatically. Might as well just use jquery then lol