0๐
Iโm not familiar with vuetify, but if you could simply use the .model
property of each project object as the switch v-model
, you could make .enabled
a computed property instead of a data property:
computed: {
enabled() {
return this.projects.some(project => project.model);
}
}
0๐
I believe you are trying to enable the input if one switch is on but have it disabled if all four switches are off.
The disabled property can be bound to a computed property that returns false if one of the switches is on and true if all four switches are off.
If this is a custom component, another options is to emit a custom event from the child component (v-switch) that emits whether the switch is on or off, and then call a method that sets a Boolean that you bind to :disabled.
Source:stackexchange.com