Once the user has entered the quantity and clicked the <
> button, we need to create aSaleItem
and add it to the
items
arrary in the data store.
The following is the data store mutation for adding to the items
array:
// add item to cart addItem(state, item) { state.items.push(item); },
You can use this mutation in a click handler function as follows:
dataStore.commit("addItem", new SaleItem(this.product, this.quantity));