Conditionally rendering

Use v-if, v-else-if, v-else (test by change property in console)

No beers were returned
1 beer was returned
{{beers}} beers were returned
Conditionally renders the element

Use v-show (test by change property in console)

No beers were returned
{{beers}}
Always renders the element (toggles CSS display properties)

Render List of items

loop over "item_i in list":

or loop over "item_i of list" (more consistent with JavaScript syntax):

Note that the loop starts at 1 (?? I dont' get it... See below...)

Traversing object properties

Looping through all property values in "currentUser"

To get each property name and property value:

To get each index as well

I.e use value, key, index

looping over a range - the alias starts at 1

properties - the alias starts at 0

Iterating through arrays

Or, to get index:

Iterating through nested arrays

Page: {{page.number}}
Page {{page.number}}, section {{sec}}

Using v-for and v-if together (for has precedence)

{{maxAbv}}%

Detecting array changes

List to apply changes on:






Fast detta blir ju fel ordning?!
Note that Vue cannot update individual Array elements