version/0412
shuxiaoquan 11 months ago
parent 1793d8f1a4
commit 12449a517f
  1. 9
      pages/category/index.vue

@ -85,17 +85,16 @@
if (index == this.current) return; if (index == this.current) return;
this.scrollRightTop = this.oldScrollTop; this.scrollRightTop = this.oldScrollTop;
this.$nextTick(function() { this.$nextTick(function() {
// this.current = index; this.current = index;
this.scrollRightTop = this.arr[index]; this.scrollRightTop = this.arr[index];
this.leftMenuStatus(index); this.leftMenuStatus(index);
}) })
}, },
getGoodsTypeList() { getGoodsTypeList() {
const that = this; const that = this;
console.log(cstegory.list(), '接口地址')
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
cstegory.list({ cstegory.list({
is_hot: 0 // is_hot: 0
}) })
.then(res => { .then(res => {
// //
@ -147,9 +146,9 @@
await this.getElRect('menu-scroll-view', 'menuHeight'); await this.getElRect('menu-scroll-view', 'menuHeight');
await this.getElRect('u-tab-item', 'menuItemHeight'); await this.getElRect('u-tab-item', 'menuItemHeight');
} }
this.current = index;
// item // item
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2; this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2;
this.current = index-1;
}, },
// item // item
@ -166,7 +165,7 @@
} }
rects.forEach((rect) => { rects.forEach((rect) => {
// rects[0].top() // rects[0].top()
this.arr.push(rect.top - rects[0].top + 5); this.arr.push(rect.top - rects[0].top);
resolve(); resolve();
}) })
}).exec() }).exec()

Loading…
Cancel
Save