I have an list like this one
<div class="list-group entity-list">
<a v-for="entity in master.data"
:class="['entity list-group-item', entity.selected ? 'selected' : '']"
@click="itemselect(entity)"
>
@{{entity.name}}
</a>
</div>
The list is displayed as expected. The Bound entity is added as an prop to an outer compontent like this.
<my-compontent :entityname="customers" :master="{{json_encode($customers->toArray())}}" inline-template>
As you can see it should be a list of customers. To indicate if a customer is selected i want to set an "selected" attribute on click. However it does not seem to work if the default bound object does not have a select property.
methods: {
itemselect: function(item) {
this.master.data.forEach(function(el) {
el.selected = false;
});
item.selected = true;
}
}
The shown method does not seem to work / trigger a change