2👍
You need to use a Number
instead of a String
for 0
See jsfiddle here.
HTML
<div id="react">
<button @click="counter += 5">Increment</button>
<p>{{ result }}</p>
</div>
JS
new Vue({
el: '#react',
data: {
counter: 0
},
computed: {
result: function() {
return this.counter;
}
}
})
0👍
counter
is defined with ‘0’(String) instead of 0(number).
You also don’t need the computed value to show the result.
Only {{counter}}
would be enough.
- [Vuejs]-Mixing WordPress eCommerce site with external login based Vue Frontend Best Practices
- [Vuejs]-Unable to use vue-airbnb-style-datepicker with Nuxt
Source:stackexchange.com