1
I have been running a simple "for" command with Vue.js. I want to present in "console.log" what was the value clicked.
I arrived at the result of presenting a static array value in console.log, but I need the exact click value.
let app = new Vue({
el: '#app',
data: {
charges:
[
{ title: 'Título 1' },
{ title: 'Título 2' }
]
},
methods: {
modalContent(){
console.log(this.charges.title = this.charges[0].title);
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<div v-for="item in charges">
<button @click="(modalContent())"> {{ item.title }} </button>
</div>
</div>