<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>条件与循环</title><script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script></head><body><h1>判断示例</h1><div id="app"><p v-if="seen">现在你看到我了</p></div><hr><div id="app-1"><p v-if="seens">真为显示 假为隐藏</p><p>hi。。。。</p></div><hr><h1>循环示例</h1><div id="app-2"><ul><li v-for="todo in todos">{{ todo.text }}</li></ul></div><script type="text/javascript">// 判断var app = new Vue({el: "#app",data: {seen: true}})var app1 = new Vue({el: "#app-1",data: {seens: false}})// 循环var app2 = new Vue({el: "#app-2",data: {todos: [{text: '学习 JavaScript'},{text: '学习 Vue'},{text: '整个牛项目'}]}})</script></body>
</html>