[Vuejs]-How to get value from radio group?

4👍

The v-model property of <v-radio-group> contains the value of the selected <v-radio>. To make it easier to find the one you selected, I would suggest add an id to each option and use it as the value.

To get the type of the selected option, you can then add a computed property like so:

  computed: {
    selectedOptionType() {
      if (!this.selectedOptionId) {
        return "";
      }
      return this.options.find(o => o.id === this.selectedOptionId).type;
    }
  }

See this CodePen for a working example.

Leave a comment