Commit 3bfaf4d5 authored by 潘永坪's avatar 潘永坪

bug处理

parent 5b45ed41
......@@ -224,6 +224,8 @@ export default {
middleInfoStyle:'',//中间盒子上部分样式
middleBottomStyle:'',//中间盒子下部分样式
infoHeight:0,//middle-info盒子高度
scrlllHeight:0,//中间盒子滚动时的高度
originHeight:0,//中间盒子原本高度
}
},
watch: {
......@@ -428,15 +430,22 @@ export default {
uni.getSystemInfo({
complete:(info)=> {
let windowHeight=info.windowHeight||753
//获取元素都用 uni.createSelectorQuery(),不要用变量代替,不然会循环。
//获取中间盒子需要滚动时的高度
uni.createSelectorQuery().in(this).select('.merchant-info').boundingClientRect(data => {
//获取中间盒子的高度
if(data){
this.infoHeight=data.height
this.xxx=windowHeight-this.infoHeight
this.middleHeight=3000
this.scrlllHeight=windowHeight-this.infoHeight
}
}).exec()
//获取中间盒子原本高度
uni.createSelectorQuery().in(this).select('.middle-right').boundingClientRect(data => {
//获取中间盒子原本高度,默认中间盒子等于原本高度,滚动之后等于滚动高度
if(data){
this.originHeight=data.height
this.middleHeight=this.originHeight
}
}).exec()
//不要这样 多个的时候就会循环 varquery = uni.createSelectorQuery()
for(let i=0;i<this.scenicList.length;i++){
uni.createSelectorQuery().in(this).select(`#merchant${i}`).boundingClientRect(data => {
......@@ -513,10 +522,13 @@ export default {
},
//---商家下标切换
merchantTabChange(index){
this.merchantIndex=index
//点击右边可滚动
this.middleHeight=this.xxx
this.toViewRight='merchant'+index
this.middleHeight=this.scrlllHeight
//加个延时,防止第一次点击时无效果
this.$nextTick(()=>{
this.merchantIndex=index
this.toViewRight='merchant'+index
})
},
//---展示明细弹窗
showDetail() {
......@@ -531,13 +543,15 @@ export default {
//20=中间盒子top:-20的值
height=data.height-20
if(e.detail.scrollTop>height){
//商家信息固定,中间可滚动,全屏不滚动
this.middleInfoStyle='top:0;position:fixed;'
this.middleBottomStyle=`margin-top:${this.infoHeight}px`
this.middleHeight=this.xxx
this.middleHeight=this.scrlllHeight
}else{
//商家不固定,中间不可滚动,全屏滚动
this.middleInfoStyle='position:relative;'
this.middleBottomStyle='margin-top:0'
this.middleHeight=3000
this.middleHeight=this.originHeight
}
}
}).exec()
......@@ -548,12 +562,12 @@ export default {
scrollRight(e) {
setTimeout(()=>{
let scrollTop=e.detail.scrollTop
if(scrollTop==0){
//当滑到顶部时,上面固定元素还原
this.middleInfoStyle='position:relative;'
this.middleBottomStyle='margin-top:0'
this.middleHeight=3000
}
// if(scrollTop==0){
// //当滑到顶部时,上面固定元素还原
// this.middleInfoStyle='position:relative;'
// this.middleBottomStyle='margin-top:0'
// this.middleHeight=3000
// }
//通过滚动值获取下标
this.heightArr.forEach((item,i)=>{
if(i==0){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment