<body id=app>
<!-- 用一个 v-for 循环,依次展示数据 -->
<div v-for="article in articles">
<h3>{{ article.title }}</h3>
<p>{{ article.content }}</p>
</div>
<script>
var vm = new Vue({
el: "#app",
data: {
// 有多条数据的时候,用数组包装
articles: [
{title: "标题 1", content: "内容1"},
{title: "标题 2", content: "内容2"},
{title: "标题 3", content: "内容3"}
]
}
})
</script>
</body>
网页如下: