I have a b-form-select and when I choose one option I want to enable my button. But I don't know how to check if there is a value in my selection.
Thanks for helping me out !
<b-form-select v-model="data.Name" :value="data.Name"></b-form-select>
<b-button :disabled="!validDataAdded"></b-button>
computed: {
validDataAdded: function(){
return //Check here
},
}
In order to answer that question first we need to make some things clear.
v-model uses the :value attribute under the hood as a way to communicate with the component and pass down values.
That been said you dont need to add a :value attribute to your select component. If you need to set a initial value you simply need to set an initial value to your v-model.
If you want to check if there is a value to your selection you just need to check if the v-model has a value. Remember that a v-model corresponds to a property (either part of data or computed section).
In you example you need to check if data.Name contains a value or not.
Check out this sandbox where I create an example for you according you code-snippet.
Last but not least the way that you have written your v-model it seems that you have an object called data inside your data property