[Vuejs]-Get selected dropdown value in vue.js

1👍

This is how vue dropdown looks like:

<template>
  <div>
    <b-form-select v-model="selected" :options="options"></b-form-select>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        selected: null,
        options: [
          { value: 1, text: 'Please select an option' },
          { value: 2, text: 'This is First option' },
          { value: 3, text: 'Selected Option' }
        ]
      }
    }
  }
</script>

You can also add ref attribute to your dropdown like this:

<b-form-select ref="myDropdown" :options="options"></b-form-select>

and then inside scripts something like this should work:

this.$refs.myDropdown.value

$refs is equivalent of jquery selector. ref is component scoped id.

Leave a comment