Looking for the best way to capture user-clicked {{exchange}} in a Vue code snippet
<ul>
<li v-for="exchange in finalExchanges"><button class="resultBtn"> {{exchange}} <hr></button></li>
</ul>
The JavaScript associated with this code looks like this:
export default {
name: 'exchange',
data () {
return {
exchanges,
msg: 'Exchange',
search: ''
}
},
computed: {
finalExchanges() {
return this.exchanges.filter(exchange => {
return exchange.includes(this.search)
})
}
}
}
What is the most efficient way to capture the {{exchange}} that a user clicks on and store it in a variable? Possible options include using document.getElementById() or a Vue-specific method. However, I am seeking a solution that is not only efficient but also future-proof. Your insights are greatly valued!