labs / tiddlers / content / labs / lab09 / _Labs_09_Adding to the
@Mark George Mark George on 10 Sep 522 bytes WIP lab 9

Once the user has entered the quantity and clicked the <

> button, we need to create a SaleItem and add it to the items arrary in the data store.

  1. The following is the data store mutation for adding to the items array:

     // add item to cart
     addItem(state, item) {
  2. You can use this mutation in a click handler function as follows:

    dataStore.commit("addItem", new SaleItem(this.product, this.quantity));