The two elements problem

Let's create a carousel effect for our website. The user will view one product at a time and then he will swipe to the next product. To swipe to the next product the user will need to click a button.

First, we need our list of products in the Vue instance:

new Vue({   el: '#app',   data: {     product: 0,     products: ['umbrella', 'computer', 'ball', 'camera']   } })

In our HTML, we will only need a button and the view of an ...

Get Vue.js 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.