vue笔记—–component粒子2

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}

]

}

})

IT文库 » vue笔记—–component粒子2
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址