I have a Vue component with an array that includes IDs which I want to remove while keeping the other elements intact. Is there a way to achieve this within a method?
Is it possible to filter out the ID index from the array using Vue methods?
var vm =
new Vue({
el: "#app",
data: {
options: [
{id:100, option:"1 - John Doe"},
{id:200, option:"2 - Jane Doe"}
]
},
methods: {
getNames(){
let names = this.options;
console.log(names);
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<button @click="getNames()">TEST</button>
</div>