in Tutorials, Vue.js

Directives in Vue

This example uses directives in Vue. To begin with learning directives, start by creating a new folder vue-directives. 

Directives serve as one of the primary ways, the user interacts with the view. Be it web view or mobile view.

In this example, we will create an element and on hovering over the element, we will display a random number. 

To achieve this, we will continue with the index.html from the first part. Create an index.html in the vue-directives folder and add the following code. Comments in the code explain what is what.

Save the code and run it to see the random number being generated and shown to you on hovering the element.

0