[Vuejs]-Disable/enable select depending on value vuejs

2👍

You can use conditional rendering:

ns-dropdown-item(item-id="7")    
  ns-select(:placeholder="$t('users.client')", v-model="client", 
    :options="clients", 
    :disabled="newLeader.role !== 'manager' || newLeader.role !== 'coordinator'")

This will add disabled property only when role is not manager nor coordinator.


But this would be a security issue. Why you’re just disabling them? You should not have element rendered at all. Thus, I suggest you to use v-if statement so that it will be only rendered when the condition is matched else the element is not present in the DOM.

ns-dropdown-item(item-id="7")    
  ns-select(:placeholder="$t('users.client')", v-model="client", 
    :options="clients", 
    v-if="newLeader.role === 'manager' || newLeader.role === 'coordinator'")

Leave a comment