var VueTouch = require('vue-touch')
Lib.Vue.use(VueTouch, {name: 'v-touch'})
<v-touch class="ul" v-on:pandown="onPanStart" //向下滑动 v-on:panmove="onPanmove" //滑动结束 v-on:panup="onPandup"> //向上滑动 </v-touch>
//我没用到这句
v-bind:pan-options="{ direction: 'panup', threshold: 100 }">
//省去一些 代码
var lefthe = 0; //检测滑动的位置
onPanStart:function(data)
{
this.positionjson.transition=''
console.log(data)
var y = data.deltaY; //事件执行 所滑动的距离
lefthe = y + this.lefthe; //滑动的距离 记录到 lefthe 方便下次执行
console.log(lefthe)
if(lefthe >=50)
{
//限制 不能一直往上拉 拉到宇宙呢?我这里是写死的
lefthe = 0;
//回弹效果 在 滑动结束后 执行
return
}else{
}
this.positionjson.top = lefthe +'px';
},
onPanend:function(data)
{
if(lefthe ==0)
{
console.log('现在是0')
this.positionjson.top = lefthe +'px';
//滑动结束 执行 一些事件 lefthe 0 的时候其实也就是下拉到顶的过程
this.positionjson.transition='0.2s ease 0s'
}else{
}
this.lefthe = lefthe;
},
//上拉代码块
onPandup:function(data)
{
var domul =document.getElementById('domul');
this.positionjson.transition=''
var y = data.deltaY; //下拉的距离
var boxheight = this.boxheight; //视图高度 也就是分辨率
var liheight = document.getElementById('libox').clientHeight; //左侧每个li的高度
console.log(liheight+'元素的高')
var zongheight = this.navapi.list.length * 70; //就能得出li父盒子高度
var bottomheight = -(zongheight - boxheight) + -100; //计算下拉到 滑动盒子的高度 - 视图高度 =上拉到底的位置
if(lefthe <= bottomheight)
{
// console.log('到底啦啦啦啦啦')
return;
}else{}
lefthe = y + this.lefthe;
this.positionjson.top = lefthe +'px';
},
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有