javascript - How can I put Customer Name in the vs-input using loop, then it should pass the customer id to form.co_id in VueJS

How can I put Customer Name in the vs-input using loop, then it should pass the customer id to form.co_id in VueJS? The looping part is done, I just can't figure out how can I output the customer name but it will pass customer id to form.co_id.
I have this code:
<div v-for="(customer, co_id) in filteredCustomers" :key="co_id" :value="customer.co_id">
<vs-input type="text" v-bind:value="customer.co_name" v-on:input="form.co_id = $event.target.value"></vs-input>
</div>
and VueJS
data() {
return {
form: { co_id:'')
}
},
computed: {
filteredCustomers(){
let filteredCustomers = [];
for(let i = 0 ; i < this.customers.length ; i++) {
let customers = this.customers[i];
if(customers.co_id == this.form.device.customer_id) {
filteredCustomers.push(customers);
}
}
console.log(filteredCustomers);
return filteredCustomers;
},
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: trying to access array offset on value of type bool
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.