0

I'm trying to get idTipoExame from this JSON:

{
  "idTipoExame": "11",
  "mnemonico": "AUR",
  "exame": "ACIDO URICO"
},
{
  "idTipoExame": "24",
  "mnemonico": "BTF",
  "exame": "BILIRRUBINA TOTAL E FRACOES"
},

I tried to use @change, but I get "exame" from target.value. Here my Code Html and My function:

Javascript:

ExameEvent(event) {
console.log(event.target.value)
}

HTML:

 <select v-model="Exame" @change="ExameEvent($event)>
    <option v-for="item in JSON" :key="item.JSON">{{item.exame}}</option>
  </select>
Umutambyi Gad
  • 4,082
  • 3
  • 18
  • 39
Veterano
  • 23
  • 4
  • 2
    Does this answer your question? [Vue.js get selected option on @change](https://stackoverflow.com/questions/50982408/vue-js-get-selected-option-on-change) – Adam Azad Jul 30 '20 at 19:31

1 Answers1

0

You could add the value to the option tag and then get the value from the event.

<option v-for="item in JSON" :key="item.JSON" :data-id="item.idTipoExame">
vanDee
  • 26
  • 3