其他分享
首页 > 其他分享> > vue第七大功能:v-for,循环

vue第七大功能:v-for,循环

作者:互联网

<!DOCTYPE html>
<div id="list-rendering">
    <ol>
        <li v-for="todo in todos">
            {{ todo.text }}
        </li>
    </ol>
</div>
</html>

<script src="https://unpkg.com/vue@next"></script>
<script>
const ListRendering = {
    data() {
        return {
            todos:[
                { text: 'Learn JavaScript' },
                { text: 'Learn Vue' },
                { text: 'Build something awesome' }
            ]
            //message:'You loaded this page on'
            //文本插值的时候,这里是counter:0
        }
    }
}

Vue.createApp(ListRendering).mount('#list-rendering');
</script>

todo in todos

不是很懂todo.text

ol是1、2、3序号
li是原点

标签:vue,第七,text,ListRendering,Vue,循环,Learn,todo,todos
来源: https://blog.csdn.net/weixin_40945354/article/details/119062125