(1)html代码:
<div id="app"> <ul> <li v-for="todo in todos"> {{ todo.text }} </li> </ul> </div>
(2)js代码:<script> new Vue({ el:'#app', data: { todos: [ { text: 'Learn JavaScript' }, { text: 'Learn Vue.js' }, { text: 'Build Something Awesome' } ] } }); </script>
(3)效果展示: