Write For Loop in Vue.js

January 9, 2018

You can use the v-for directive to write For Loop in Vue.js

I am going to generate checkbox fields to select days with following code. I have used v-for directive to make the for loop

Select Day
{{day}}

This is the Vue.js code with days array which will hold the days of the week


You can have the following output when you open this code in browser

If you want to show the selected days you can use the following modified code


      
Select Day
{{day}}
You have selected : {{selected_days}}