2017-08-14 32 views
0

我想在那裏我有以下代碼如何禁用動態地Vuejs

<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> 

我想禁用v-select元素,如果即http://sagalbot.github.io/vue-select/v-modelwithClient = 0,使建立在VueJs 2.0應用V-選擇選項withClient= 1

<v-select multiple :options="contacts" :on-search="getOptions" placeholder="Contact name" v-model="contactParticipants"></v-select> 
+0

'v-select'是什麼?這是:http://sagalbot.github.io/vue-select/? – thanksd

+0

@thanksd是的,它是 –

+1

目前,它看起來像禁用組件不是一個選項。但是,有一個拉的請求它https://github.com/sagalbot/vue-select/pull/118/files?diff=split – thanksd

回答

1

如果 「禁用」 目前還不支持,這是很容易添加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

如果你已經包含'toggle'功能,使'禁用'類真假。 –