<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>ssc_web</title>
<script src="https://cdn.bootcss.com/vue/2.6.4/vue.min.js"></script>
</head>
<body>
<div id="app">
<div id="scrollTree" style="height: 200px; 300px;overflow: auto">
<div style="height: 5000px;position: relative">
<div v-for="item in data" :style="{top:(item-1)*50+'px'}"
style="height: 50px;position: absolute; 100%">
{{item}}
</div>
</div>
</div>
</div>
<!-- built files will be auto injected -->
</body>
<script>
var vm = new Vue({
el: '#app',
data: function () {
return {data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]};
},
mounted: function () {
document.getElementById('scrollTree').onscroll = function (e) {
let i = parseInt((e.target.scrollTop + 250) / 50);
if (i > 95) i = 95;
vm.data = [i - 4, i - 3, i - 2, i - 1, i, i + 1, i + 2, i + 3, i + 4, i + 5];
};
}
});
</script>
</html>