|
@@ -4,7 +4,7 @@
|
|
<div class="menu-wrapper" ref="menuWrapper">
|
|
<div class="menu-wrapper" ref="menuWrapper">
|
|
<ul>
|
|
<ul>
|
|
<li v-for="(item,index) in goods" class="menu-item" :class="{'current':currentIndex===index}"
|
|
<li v-for="(item,index) in goods" class="menu-item" :class="{'current':currentIndex===index}"
|
|
- @click="selectMenu(index,$event)">
|
|
|
|
|
|
+ @click="selectMenu(index,$event)" ref="menuList">
|
|
<span class="text border-1px">
|
|
<span class="text border-1px">
|
|
<span v-show="item.type>0" class="icon" :class="classMap[item.type]"></span>{{item.name}}
|
|
<span v-show="item.type>0" class="icon" :class="classMap[item.type]"></span>{{item.name}}
|
|
</span>
|
|
</span>
|
|
@@ -74,6 +74,7 @@
|
|
let height1 = this.listHeight[i];
|
|
let height1 = this.listHeight[i];
|
|
let height2 = this.listHeight[i + 1];
|
|
let height2 = this.listHeight[i + 1];
|
|
if (!height2 || (this.scrollY >= height1 && this.scrollY < height2)) {
|
|
if (!height2 || (this.scrollY >= height1 && this.scrollY < height2)) {
|
|
|
|
+ this._followScroll(i);
|
|
return i;
|
|
return i;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -156,6 +157,11 @@
|
|
height += item.clientHeight;
|
|
height += item.clientHeight;
|
|
this.listHeight.push(height);
|
|
this.listHeight.push(height);
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ _followScroll(index) {
|
|
|
|
+ let menuList = this.$refs.menuList;
|
|
|
|
+ let el = menuList[index];
|
|
|
|
+ this.meunScroll.scrollToElement(el, 300, 0, -100);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|