From 42ae27200b9ced7ac14075243773a43f72781853 Mon Sep 17 00:00:00 2001
From: H <30830569@qq.com>
Date: Wed, 20 Jul 2022 15:18:21 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=BB=91=E5=8A=A8=E9=80=89?=
=?UTF-8?q?=E4=B8=AD=E6=95=88=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/sort/index.vue | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/pages/sort/index.vue b/src/pages/sort/index.vue
index 87ce5f4..a871b83 100644
--- a/src/pages/sort/index.vue
+++ b/src/pages/sort/index.vue
@@ -20,14 +20,15 @@
:scroll-into-view="itemId">
- {{ item.name }}
+ {{ item.name }}{{current}}
-
+
{{ item1.name }}
@@ -44,6 +45,7 @@
+
@@ -155,7 +157,7 @@ export default {
getMenuItemTop() {
new Promise(resolve => {
let selectorQuery = uni.createSelectorQuery();
- selectorQuery.selectAll('.class-item').boundingClientRect((rects) => {
+ selectorQuery.selectAll('.classSel').boundingClientRect((rects) => {
// 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行
if (!rects.length) {
setTimeout(() => {
@@ -173,7 +175,11 @@ export default {
},
// 右边菜单滚动
async rightScroll(e) {
- this.oldScrollTop = e.detail.scrollTop;
+ if(e.detail.scrollTop<20){
+ this.swichMenu(0)
+ return
+ }
+ this.oldScrollTop = e.detail.scrollTop;
if (this.arr.length == 0) {
await this.getMenuItemTop();
}
@@ -186,8 +192,10 @@ export default {
// scrollHeight为右边菜单垂直中点位置
let scrollHeight = e.detail.scrollTop + this.menuHeight / 2;
for (let i = 0; i < this.arr.length; i++) {
+
let height1 = this.arr[i];
let height2 = this.arr[i + 1];
+ // console.log(this.arr,height1,height2,'@@@@',scrollHeight)
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) {
this.leftMenuStatus(i);
@@ -210,7 +218,7 @@ export default {
.u-wrap {
height: calc(100vh);
/* #ifdef H5 */
- height: calc(100vh - var(--window-top));
+ height: calc(100vh - var(--window-top));
/* #endif */
display: flex;
flex-direction: column;