Skip to content

Commit 3e2a0db

Browse files
committed
修复shop页面menu shop问题
1 parent 4185842 commit 3e2a0db

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

elm/static/js/manifest.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

elm/static/js/shop.27b17c92296aeebffd93.min.js renamed to elm/static/js/shop.23495dc983ca8264b6a9.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/page/shop/shop.vue

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@
362362
elLeft: 0, //当前点击加按钮在网页中的绝对top值
363363
elBottom: 0, //当前点击加按钮在网页中的绝对left值
364364
ratingScroll: null, //评论页Scroll
365-
wrapperMenu: null,
366365
imgBaseUrl,
367366
}
368367
},
@@ -448,19 +447,15 @@
448447
},
449448
//获取食品列表的高度,存入shopListTop
450449
getFoodListHeight(){
451-
const baseHeight = this.$refs.shopheader.clientHeight;
452-
const chooseTypeHeight = this.$refs.chooseType.clientHeight;
453450
const listContainer = this.$refs.menuFoodList;
454451
const listArr = Array.from(listContainer.children[0].children);
455452
listArr.forEach((item, index) => {
456-
this.shopListTop[index] = item.offsetTop - baseHeight - chooseTypeHeight;
453+
this.shopListTop[index] = item.offsetTop;
457454
});
458455
this.listenScroll(listContainer)
459456
},
460457
//当滑动食品列表时,监听其scrollTop值来设置对应的食品列表标题的样式
461458
listenScroll(element){
462-
let oldScrollTop;
463-
let requestFram;
464459
this.foodScroll = new BScroll(element, {
465460
probeType: 3,
466461
deceleration: 0.001,
@@ -469,23 +464,23 @@
469464
click: true,
470465
});
471466
472-
this.wrapperMenu = new BScroll('#wrapper_menu', {
467+
const wrapperMenu = new BScroll('#wrapper_menu', {
473468
click: true,
474469
});
475470
471+
const wrapMenuHeight = this.$refs.wrapperMenu.clientHeight;
476472
this.foodScroll.on('scroll', (pos) => {
477473
if (!this.$refs.wrapperMenu) {
478474
return
479475
}
480476
this.shopListTop.forEach((item, index) => {
481477
if (this.menuIndexChange && Math.abs(Math.round(pos.y)) >= item) {
482478
this.menuIndex = index;
479+
const menuList=this.$refs.wrapperMenu.querySelectorAll('.activity_menu');
480+
const el = menuList[0];
481+
wrapperMenu.scrollToElement(el, 800, 0, -(wrapMenuHeight/2 - 50));
483482
}
484483
})
485-
let wrapMenuHeight = this.$refs.wrapperMenu.clientHeight;
486-
let menuList=this.$refs.wrapperMenu.querySelectorAll('.activity_menu');
487-
let el = menuList[0];
488-
this.wrapperMenu.scrollToElement(el, 800);
489484
})
490485
},
491486
//控制活动详情页的显示隐藏

src/untitled

Whitespace-only changes.

0 commit comments

Comments
 (0)