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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.