关于对象遍历的问题

https://img.mukewang.com/5bc69f6d00010df206410757.jpg

https://img4.mukewang.com/5bc69f7f0001a7ed05170288.jpg

当每次点击按钮的时候,所有的votes都++了,怎么样才能单独的votes++呢?


饮歌长啸
浏览 515回答 1
1回答

慕桂英4014372

<button&nbsp;class="btn&nbsp;btn-default"&nbsp;@click="vote($index)">Vote</button>vote:&nbsp;function&nbsp;(index)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;this.candidates[index].votes++; }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript