From 8f2c376ba839b9cd2d2e244e06774b4a8475e0cd Mon Sep 17 00:00:00 2001 From: luJianJun <2587063613@qq.com> Date: Thu, 10 Aug 2023 18:18:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E7=BB=84=E4=BB=B6=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E6=9D=A1=E9=9A=90=E8=97=8F=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/detail.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/views/detail.vue b/src/views/detail.vue index ebd4d77..f9e6e89 100644 --- a/src/views/detail.vue +++ b/src/views/detail.vue @@ -1115,23 +1115,29 @@ let imgListTab = ref(0) let interval = '' let clientWidth = ref(null) let scrollWidth = ref(null) +let scrollMove=false //点击方向按钮 let moveImageList = (type) => { if (type === 'right' && imgScrollBottom()) return if ((type === 'left' && imgListTab.value === 0) || (imgListTab.value === imageLIstLeft.value.length - 1 && type === 'right')) return type === 'left' ? imgListTab.value-- : imgListTab.value++ + console.log(imageLIstLeft.value[imgListTab.value]) setOffsetWidth(imageLIstLeft.value[imgListTab.value], type) } //设置滚动 let setOffsetWidth = (num, type) => { let scroll = 0 + if(scrollMove)return + scrollMove=true interval = setInterval(() => { if (!imageList.value) { + scrollMove=false clearInterval(interval) return } scroll = type === 'left' ? imageList.value.scrollLeft -= 10 : imageList.value.scrollLeft += 10 - if ((type === 'left' ? num >= scroll : num <= scroll) || scroll + clientWidth.value >= scrollWidth.value) { + if ((type === 'left' ? num >= scroll : num <= scroll)) { + scrollMove=false clearInterval(interval) } }) @@ -1147,11 +1153,12 @@ let imgScrollBottom = () => { let imgData = ref(null) //获取图片宽度 let setImageWidth = (num) => { - imageLIstLeft.value[num] = imgData.value[num] && imgData.value[num].offsetLeft - 20 + imageLIstLeft.value[num] = imgData.value[num] && imgData.value[num].offsetLeft if (imageLIstLeft.value.length === imgList.value.length) { clientWidth.value = imageList.value.clientWidth scrollWidth.value = imageList.value.scrollWidth } + console.log(imageLIstLeft.value) } //学校地址数据 @@ -2460,6 +2467,8 @@ img { .list-box { overflow-x: scroll; + overflow: -moz-scrollbars-none; // Firefox + -ms-overflow-style: none;// 微软 height: 120px; color: #fff;