i have an array of objects with first name and last name inside of it. How can i toggle between the first name and last name on a button click?
new Vue({
el: '#app',
data() {
return {
myArray: [{
firstName: 'ricky',
lastName: 'martin'
},
{
firstName: 'tony',
lastName: 'Montana'
}
]
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<template>
<div>
<button>Click me to switch between first and Last names</button>
</div>
</template>
I am still trying to get my head wrapped some of the basic concepts of vuejs so please excuse any naive questions. Thank you.