最终实现
父组件
<template>
<Com :list="list" />
</template>
<script setup lang="ts">
const list = [
{
height: 300,
background: 'red'
},
{
height: 400,
background: 'pink'
},
{
height: 500,
background: 'blue'
},
{
height: 200,
background: 'bisque'
},
{
height: 300,
background: 'rebeccapurple'
},
{
height: 100,
background: 'blue'
},
{
height: 200,
background: 'bisque'
},
{
height: 300,
background: 'rebeccapurple'
},
{
height: 300,
background: 'red'
},
{
height: 400,
background: 'pink'
},
{
height: 500,
background: 'blue'
},
{
height: 20,
background: 'bisque'
},