Greetings! I've been working on a basic game that increments the score by 1 when the user clicks a button.
new Vue({
el: '#MyApp',
data: {
score: '10',
},
methods: {
ScoreIncre: function(incre) {
this.score += incre;
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="MyApp">
<p>My Score is {{score}</p>
<button v-on:click="ScoreIncre(1)">Increase my Score</button>
</div>
After clicking the button, instead of adding 1 to the score, it displays as 'My Score is 101.' What could be causing this issue? I attempted to parse 'incre' as an integer, but the result remained the same.