<template>
<div>
<div class="box">
<ul @touchstart='touchstart' @touchmove='touchmove' @touchend='touchend' class="scroll">
<li v-for="(item, i) in list" :key="i">列表{
{i}}</li>
</ul>
</div>
</div>
</template>
<style>
.box{
height: 400px;
overflow: hidden;
border: 2px solid #cccccc;
width: 60px;
text-align: center;
position: fixed;
left: 10px;
top: 50%;
transform: translateY(-50%)
}
.box ul li{
display: flex;
flex-direction: column;
line-height: 30px;
}
</style>
<script>
// 参考:https://segmentfault.com/a/1190000017852497
export default {
data () {
return {
list: Array(16),
startY: 0,
maxDown: 40, //设置最大的下滑的区间
原生JS实现Touch滑动反弹
最新推荐文章于 2021-01-15 23:12:21 发布