v-for Directive in Vue.js

v-for directive is a Vue.js directive used to loop over a data usually an array or object. First, we will create a div element with id as app and let’s apply the v-for directive to an element with data. Now we will create this data by initializing a Vue instance with the data attribute containing the value.
Syntax:
v-for="data in datas"
Parameters: This function accepts data which is either an array or object over which we will loop over.
Example: This example uses Vue.js to loop over an array with v-for.
| <!DOCTYPE html> <html>  <head>     <title>         VueJS | v-for directive     </title>      <!-- Load Vuejs -->    <scriptsrc=     </script> </head>  <body>     <divstyle="text-align: center;         width: 600px;">                  <h1style="color: green;">             zambiatek         </h1>                  <b>             VueJS | v-for directive         </b>     </div>      <divid="canvas"style=         "border:1px solid #000000;         width: 600px;height: 200px;">          <divid="app">             <h2v-for="data in datas">                 {{data}}             </h2>         </div>     </div>      <script>         var app = new Vue({             el: '#app',             data: {                 datas: [                     'Hello',                      'World',                      'zambiatek'                 ]             }         })     </script> </body>  </html>  | 
Output:
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
 
				 
					



