Dies ist eine alte Version des Dokuments!


LU05.S10 - v-if and functions

  • Download the file and copy the content into the code area of the W3School on the left hand side of the coding window.
  • You can execute the code by pressing the run button
  • The result will be presented in the right hand side of the window.

As we are now capable to use v-if with logical values (true/false), and furhtermore check actual values e.g. numbers, this assignment is about hoch to check stings (words). For this we are going touse the function text.includes() within our v-if.

  1. Execute the script. As you can see the content of the variable text is displayed on the screen.
  2. Now delete the word Pizza from the variable text. Execute your script again.
  3. Note your realisations as a html-comment.
  4. Save your script acoordingly, whether in your W3School workspace or on you local computer in your code-editor Webstorm

In the if paragraph there is a image of a pizza displayed as well.

  1. Add a section v-else with a according img-tag which shows a different image than a pizza.
  2. Note your realisations as a html-comment.
  3. Save your script acoordingly, whether in your W3School workspace or on you local computer in your code-editor Webstorm
  • en/modul/m291/learningunits/lu05/loesungen/10.1743060974.txt.gz
  • Zuletzt geändert: 2025/03/27 08:36
  • von vdemir