I have a component command-button wrapping a Vuetify v-btn component.
command-button receives a property called disabled of type boolean, non-required and false by default.
command-button is being used inside another component called toolbar where inside a v-for loop I add the command-button using a configuration array of actions objects passed to toolbar as a property.
<command-button
v-for="(action, index) in actions"
:key="index"
:label="action.label"
:disabled="action.disabled"
@click="action.handler"
></command-button>
When I use my toolbar component in my view component like this:
<toolbar :actions="actions"></toolbar>
I declare the actions of the toolbar in the data of my view component, as follows:
data() {
return {
...
actions: [
{
label: "Delete",
handler: this.onDelete,
disabled: this.disable // This can be a computed or a data element
},
{
label: "Add",
handler: this.onAdd
}
],
...
},
The issue is that the command-button is not being disabled dynamically, no matter if I use a computed or a member in data. It only works if I use the literal true inside the actions configuration object. Making some debugging, the value received inside toolbar for the disabled attribute of actions element is undefined.
labelattribute?