• +91 9723535972
  • info@interviewmaterial.com

Vue JS Interview Questions and Answers

Question - What are the most commonly used Directives in Vue.js? / What do you understand by the conditional directives in Vue.js?

Answer -

There are a set of directives in Vue.js used to show or hide elements according to the conditions. These directives are also known as conditional directives.

  • v-if
  • v-else
  • v-else-if
  • v-show
  • v-model
  • v-on
v-if directive: The v-if directive is used to add or remove the DOM elements based on the given expression. For example, the below button will not show if isLoggedIn if you set it to false.

  
The v-if directive also facilitates you to control multiple elements with a single v-if statement by wrapping all the elements in a