[Vuejs]-How can I get the selected value of an object in an array on click?

1👍

I don’t see a comparison of the selected number and the number in each objects you’re looping over. You need something like this:

if (selectedNumber === obj[i].number) {
    this.$store.commit("updateNumber", selectedNumber);
    break;
}

Where selectedNumber is the number being passed to the method.

@click="onSelect(call.number)"

methods: {
    onSelect(selectedNumber) { ...
👤wdm

Leave a comment