Courses
Vue Foundations Vue Fullstack Vue Enterprise
Articles
Latest Topics
More
Newsletter Sponsorship Discord About
The video for this lesson is currently being updated, please read the transcript instead.
Build Your First Vue.js App > Lesson 22

Implementing inc and dec logic

In the last video, we created quantity controls for our cart items and stubbed a corrosponding inc and dec method.

Let's now implement the logic of these two methods.

inc method logic

Let's begin with inc. We're passing in the item that the user wants to increment. So the logic for the quantity will simply be item.qty++.

Keep in mind we also need to increment the total value as well by the price of the item. We can do that by going this.total += item.price.


Back to course page

Click to load comments...

Courses
  • Vue Foundations
  • Vue Fullstack
  • Vue Enterprise
Articles
  • Latest
  • Topics
Newsletter
  • Join
  • Sponsorship
More
  • Discord
  • Vue.js jobs
  • About

Vue.js Developers © 2021. View our privacy policy .

  • RSS
  • |
  • Atom