VOOZH about

URL: https://www.geeksforgeeks.org/javascript/v-else-if-directive-in-vue-js/

⇱ v-else-if Directive in Vue.js - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

v-else-if Directive in Vue.js

Last Updated : 15 Jul, 2025
v-else-if directive is a Vue.js directive used to toggle the display CSS property of an element depending on a condition when the if condition is not satisfied. First, we will create a div element with id as app and let's apply the v-else-if directive to an element with data. Now we will create this data by initializing a Vue instance with the data attribute containing the value.


Syntax:

v-else-if="data"


Parameters: This function accepts a single parameter which is data or a condition. Example 1: This example uses Vue.js to show an element with v-else-if using arithmetic conditions.

Output:

👁 Image
Example 2: This example uses Vue.js to show an element with v-else-if using Booleans.

Output:

👁 Image
Comment
Article Tags: