This example uses the Vue directives v-for
to duplicate some HTML code to show the entries of the array property vm.sport
.
I don't really like sports
My favorite sports: {{ x }}
Try the following
vm.sport
in source code and in the console. It is not exactly a JavaScript array object, but it has similar methods as an array does.vm.sport
, e.g. vm.sport.push('tennis')
, vm.sport[0] = 'badminton'
vm.sport=[]
. Check how v-if
is used to show a message instead of an empty list.