Vue Js If Else Conditionally Example Tutorial

Bootstrap 4 , Html , Css , Vue.Js




Hi Guys,

In this tutorial, I will explain you how to use if else conditionally in vue js. I show else conditionally example in vue js. The directive v-if is used to conditionally render a block. The block will only be rendered if the directive’s expression returns a truthy value.and You can use the v-else directive to indicate an “else block” for v-if


<!DOCTYPE html>



<title>Vue Js If Else Conditionally Example</title>

<link rel="stylesheet" type="text/css" href="">

<script type="text/javascript" src=""></script>


<body class="bg-dark">

<div class="container">

<div class="col-md-6 offset-md-3">

<div class="card mt-5">

<div class="card-header">

<h5 v-bind:class="red">Vue Js If Else Conditionally Example</h5>


<div class="card-body">

<div class="row">

<div class="col-md-12">

<div v-if="show">

<span class="bg-success p-1 text-white">This is show.</span>


<div v-else>

<span class="bg-danger p-1 text-white">This is not show.</span>








<script src=""></script>


Vue.config.devtools = true

var app = new Vue({



show: true,






It will help you...

Recommended Posts