vue笔记-----component粒子2

来源:互联网 发布:法兰绒格子衬衫 知乎 编辑:程序博客网 时间:2024/06/05 15:25

1.html

<div id="app">

<ol>

<todo-item v-for="item in groceryList" v-bind:todo="item"></todo-item>

</ol>

</div>

2.script

Vue.component('todo-item',{

props:[todo],

template:'<li>{{todo.text}}</li>'

})

var app = new Vue({

el:'#app',

data:{

groceryList:[

{text:'Vegetables'},

{text:cheese},

{text:Whatever else humans are suppoesd to eat}

]

}

})

0 0
原创粉丝点击