How can I switch between first name and last name in an array of objects 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 toggle between first and last names</button>
</div>
</template>
I am still trying to understand some basic concepts of vuejs, so please bear with me. Thank you.