Articles
Latest
More
Newsletter Sponsorship Discord About
Sign up for our Newsletter
The video for this lesson is currently being updated, please read the transcript instead.
Build Your First Vue.js App > Lesson 9

Adding a method

Let's add some functionality now to increase the value of the total. Over here in our products column, let's get rid of this paragraph which says "Products go here" and let's put a button here instead. Inside we'll add the text "Add to Cart".

<div class="products">
  <button>Add to cart</button>
</div>

When a button is clicked on a page, a click event is being emitted in the DOM. We can get Vue to respond to that by adding a directive to the button called v-on.


Back to course page

Click to load comments...

Articles
  • Latest
Newsletter
  • Join
  • Sponsorship
More
  • Discord
  • Vue.js jobs
  • About

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

  • RSS
  • |
  • Atom