How can I add new 2 properties inside the array of objects? Those 2 properties should be added for every object inside the array. Here is the function:
selectTag(selectedProduct, selectedTag) {
this.selectedProducts.filter(item => {
item.id === selectedProduct.id
})
.map(item => {
item.tagId=selectedTag.id, item.tagTitle = selectedTag.title
})
},
dropdown
<b-dropdown aria-role="list">
<b-button
icon-right="caret-down"
class="ToolbarButton"
size="is-small"
>
<span> {{ selectedProduct.tagTitle }} </span>
</b-button>
<b-dropdownitem
v-for="selectedTag in selectedProduct.tags"
:key="selectedTag.id"
aria-role="listitem"
@click="selectTag(selectedProduct, selectedTag)"
>
{{ selectedTag.title }}
</b-dropdownItem>
I tried above function but it didn't work. map method should be fixed. I am trying to add tagId and tagTitle properties which will get value from drop down selection for every product row... How can be it fixed?