<! DOCTYPE html><html lang="en">
<head>
<meta charset="UTF-8">
<title>Common command: V-for</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
window.onload = function () {
new Vue({
el: '#app'.data: {
arr: [12.4.5.34.2.11].users: [{
id: 9527.name: 'Tong Pak Fu'.age: 25
},
{
id: 1001.name: 'chou-heung'.age: 22
},
{
id: 1002.name: Pomegranate Sister.age: 24}}}]); }</script>
</head>
<body>
<div id="app">
<ul>
<! -- Normal loop -->
<li v-for="value in arr">{{value}}</li>
<! -- key loop -->
<! -- key specifies uniqueness -->
<li v-for="(item,index) in users" :key="index"> {{index+1}}---{{item.id}} {{item.name}} {{item.age}}</li>
</ul>
</div>
</body>
</html>
Copy the code