How to disable v-select options dynamically in Vuejs
·
Answer a question
I'm trying to build an application on VueJs 2.0
where I'm having following codes
<div class="col-sm-6">
<label class="col-sm-6 control-label">With client*:</label>
<div class="radio col-sm-3">
<input type="radio" name="with_client" v-model="withClient" value="1" checked="">
<label>
Yes
</label>
</div>
<div class="radio col-sm-3">
<input type="radio" name="with_client" v-model="withClient" value="0">
<label>
No
</label>
</div>
</div>
I want to disable v-select
i.e. http://sagalbot.github.io/vue-select/ element if v-model
withClient = 0
and enable withClient= 1
<v-select multiple :options="contacts" :on-search="getOptions" placeholder="Contact name" v-model="contactParticipants"></v-select>
Answers
If "disabled" is not yet supported, it's pretty easy to add your own:
<style>
.disabled {
pointer-events:none;
color: #bfcbd9;
cursor: not-allowed;
background-image: none;
background-color: #eef1f6;
border-color: #d1dbe5;
}
</style>
<v-select :options="['foo','bar','baz', 'hello']" v-bind:class="{ disabled: true }"></v-select>
更多推荐
所有评论(0)