<ul>
<li v-for="item in 4" :ref="liRef"></li>
</ul>
const refList = ref([]);
let offsetTops = ref([]);
const liRef = (el) => {
if (el) {
refList.value.push(el);
}
};
const getRefData = () => {
for (let i = 0; i < refList.value.length; i++) {
offsetTops.value.push(refList.value[i].$el.offsetTop);
}
};