Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
en:modul:m291:learningunits:lu05:aufgaben:17 [2025/03/22 09:29] – angelegt vdemir | en:modul:m291:learningunits:lu05:aufgaben:17 [2025/03/28 12:12] (aktuell) – vdemir | ||
---|---|---|---|
Zeile 4: | Zeile 4: | ||
* Work type: Individual | * Work type: Individual | ||
* Means of aid: only teaching materials, no websearch, no use of ai. | * Means of aid: only teaching materials, no websearch, no use of ai. | ||
- | * Timeframe: | + | * Timeframe: |
* Expected result: A Vue script that uses the v-for directive combined with v-if | * Expected result: A Vue script that uses the v-for directive combined with v-if | ||
===== Learning objectives ===== | ===== Learning objectives ===== | ||
- | - Displying | + | - Display |
===== Source ===== | ===== Source ===== | ||
- | This is the result of the previous | + | You can take your solution from the recent |
- | {{ : | + | ===== Assignment |
- | + | ||
- | + | ||
- | ===== Assignment | + | |
After successfully being able to manage 2-dimensional-arrays with the v-for directive, it is time to take next challenge: the combined usage of v-for and v-if. | After successfully being able to manage 2-dimensional-arrays with the v-for directive, it is time to take next challenge: the combined usage of v-for and v-if. | ||
- | Though the assigment | + | Though the assignment |
- | + | ||
- | + | ||
- | - Go to the link to the task mentioned in the source and save it with the appropriate name in your W3School workspace. | + | |
- | - Change the first x to z and observe what happens. | + | |
- | + | ||
- | + | ||
- | ===== Assignment 2 ===== | + | |
- | It can happen, that besides the image, we also want to display the description of our products on our website. That means, that it is time for some elbow grease. We want to handle a multi-dimensional array. Have fun with the challenge. | + | |
- | + | ||
- | - E.g.: Multidimensional arrays are manages as follows: **manyBeaches: | + | |
- | - Name the already existing entries: **img** | + | |
- | - As we just changed the dimension of our array, we need to adjust the call in the v-for-part from z to z.img. | + | |
- | - Add a < | + | |
- | - Execute your script. If everthing was done properly you will see the images as before. | + | |
- | - Now add a comment-column to you food-list (array). If you like it: **OK**. If not: **NOK** | + | |
- | - Display the comment with a figcaption-tag by using **z.comm** within a double bracket **{{}}**. | + | |
- | - Execute your script. If everthing was done properly you will see the images as before AND the comment below the image. | + | |
- | - Do the same with the names of the dishes. | + | |
- | - Execute your script. If everthing was done properly you will see the images as before, the status, but now also the names of the dishes. | + | |
- | - Comment you script accordingly an save it. | + | |
- | + | - Take your result from the previous assignment and safe it **lu05.s17.html** | |
+ | - Add a < | ||
+ | - The output is in that case of **OK**: <color # | ||
+ | - close the div | ||
+ | - Execute your script. If everything was done properly you will receive a message what you like, in red letters AND the image of the dish. | ||
+ | - Add a second <div> for the **v-else** | ||
+ | - The output is in that case of **OK**: <color # | ||
+ | - In that case there is no image to display!!! | ||
+ | - close the div | ||
+ | - Execute your script. If everything was done properly you will receive a message what you don't like, in green letters, but without the image of it. | ||
===== Solution ===== | ===== Solution ===== | ||
- | [[en: | + | [[en: |