vue中列表遍历指令为v-for
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>vue列表展示</title>
</head>
<body>
<div id="app">
{{message}}
<ul>
<li v-for='item in fruits'>{{item}}</li>
</ul>
</div>
<script src="vue.js"></script>
<script>
const app = new Vue({
el: '#app',
data:{
message:'hello',
fruits: ['apple','orange','banana','grape']
}
})
</script>
</body>
</html>
响应式的,如果fruits中增加新数据 则自动的增加一个li