Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
  <title>My first Vue page</title>
  <style>
    #app {
      border: dashed black 1px;
      width: 130px;
      padding: 0 20px 20px 20px;
      font-weight: bold;
      background-color: lightgreen;
    }
    img {
      width: 100%;
    }
  </style>
</head>
<body>
<h1>Example with 'v-if', 'v-else-if' and 'v-else'</h1>
<p>In this example all three directives 'v-if', 'v-else-if' and 'v-else' are used together.</p>
<p>The v-else part of the if-statement is active because the sentence does not contain 'pizza' or 'burrito'.</p>
<div id="app">
  <div v-if="text.includes('pizza')">
    <p>The text includes the word 'pizza'</p>
    <img src="img_pizza.svg">
  </div>
  <div v-else-if="text.includes('burrito')">
    <p>The text includes the word 'burrito', but not 'pizza'.</p>
    <img src="img_burrito.svg">
  </div>
  
  <p v-else>The words 'pizza' or 'burrito' are not found in the text</p>
</div>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
  const app = Vue.createApp({