1024Web前端之路Vue.js

7、Vue3列表渲染

2022-07-09  本文已影响0人  圆梦人生

案例

<template>
  <div v-for="(item, index) in list">{{item.name}}</div>
</template>

<script>
import { reactive } from '@vue/reactivity'
export default {
    setup(){
        let list = reactive([
            {name: 1},
            {name: 2},
            {name: 3},
            {name: 4},
            {name: 5},
        ])
        return {
            list
        }
    }
}
</script>
上一篇下一篇

猜你喜欢

热点阅读