diff --git a/src/views/apartmentDetail.vue b/src/views/apartmentDetail.vue index eca3280..e60e0d7 100644 --- a/src/views/apartmentDetail.vue +++ b/src/views/apartmentDetail.vue @@ -83,7 +83,7 @@
-
+
@@ -93,11 +93,18 @@
仅剩{{ item.allowance }}间
{{ it }}
-
-
- + + + +
+
+ +
-
+
@@ -106,7 +113,8 @@
-
+
@@ -458,12 +466,6 @@ const handleClickNav = (value) => { window.scrollTo({ top: scrollTop, behavior: 'smooth' }); - - // roomEle.value.scrollIntoView({ top: 100, behavior: 'smooth' }); - // const scrollTop = elementObj[value].offsetTop - 110; - - // window.scrollTo({ top: scrollTop, behavior: 'smooth' }); - } @@ -508,6 +510,32 @@ const contactReservationService = () => { } +let mediaBtnstate = ref({}) // 0 左边为不能点击 1 右边不能点击 2 是两个都能点击 + +const handleMediaBtn = (type, index) => { + const element = document.querySelector(`.element${index}`); + if (element) { + let left + if (type == 'left') left = element.scrollLeft - 50 + else left = element.scrollLeft + 50 + const scrollOptions = { + left, + behavior: 'smooth' + }; + element.scrollTo(scrollOptions); + + nextTick(() => { + console.log(element.scrollLeft + 460, element.scrollWidth); + if (element.scrollLeft == 0) mediaBtnstate.value[index] = 0 + else if (element.scrollLeft + 460 == element.scrollWidth) mediaBtnstate.value[index] = 1 + else mediaBtnstate.value[index] = 2 + + }) + + } +} + +