From the course: Vue.js 3 Essential Training

Unlock this course with a free trial

Join today to access over 22,500 courses taught by industry experts.

Modifying the cart

Modifying the cart

- [Instructor] We're pretty much done moving items around. So let's focus on adding some functionality. Before we do anything else, let's take a look at our cart one last time before I explain what we're going to do. So right now, if I add items, it sort of just adds them in sequence right here to this list. And so, it would be nicer since they're the same type of shirts if I could just sort of list this once and then list a quantity every time I hit the plus button. That way, my list would be much shorter and easier to read. So that's what we want to do right now. What we're going to do then is to move the cart total into app.vue. And then we're going to go through and create a new addItem method. This is going to be a different one because right, now we have something called addToCart. I'm going to change the name of it to addItem. And it's going to make an object that has the quantity as well as the product. Or…

Contents