<div>
<div>
<button @click="updateCount('countForTwo', 2)">+</button>
<button @click="updateCount('countForTwo', -2)">-</button>
</div>
<div>
<button @click="updateCount('countForFour', 4)">+</button>
<button @click="updateCount('countForFour', -4)">-</button>
</div>
</div>
<script>
data(){
return{
option:{
countForTwo: 2,
countForFour: 4,
}
}
},
methods: {
udpateCount(name, count) {
this.option[name] = this.option[name] + count;
},
}
</script>