|
|
@@ -2,20 +2,39 @@
|
|
|
<div class="productPage" :style="{ minHeight: ` calc( 100vh - ${fixedTop}px - ${barHeight}px + 44px )` }">
|
|
|
<scroll-view
|
|
|
:style="{ height: `calc( 100vh - ${fixedTop}px - ${barHeight}px + 44px )` }"
|
|
|
- :scroll-y="scrollEnabled"
|
|
|
+ scroll-y
|
|
|
class="left-side"
|
|
|
v-if="menus.length > 0"
|
|
|
+ :scroll-into-view="scrollId"
|
|
|
>
|
|
|
- <van-sidebar :active-key="activeKey" @change="changeCustomCate">
|
|
|
- <van-sidebar-item title="全部产品" />
|
|
|
- <van-sidebar-item :title="getName(item)" :key="item.id" v-for="item in menus" />
|
|
|
- </van-sidebar>
|
|
|
+ <!-- <van-sidebar :active-key="activeKey" @change="changeCustomCate">
|
|
|
+ <van-sidebar-item title="全部产品" id="cate_0" />
|
|
|
+ <van-sidebar-item :title="getName(item)" :id="`cate_${item.id}`" :key="item.id" v-for="item in menus" />
|
|
|
+ </van-sidebar> -->
|
|
|
+
|
|
|
+ <div class="left-side-item" :class="{ active: activeKey === 0 }" id="cate_0" @click="changeCustomCate(0)">
|
|
|
+ 全部产品
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div
|
|
|
+ class="left-side-item"
|
|
|
+ :class="{ active: activeKey === item.id }"
|
|
|
+ @click="changeCustomCate(item.id)"
|
|
|
+ :id="`cate_${item.id}`"
|
|
|
+ :key="item.id"
|
|
|
+ v-for="item in menus"
|
|
|
+ >
|
|
|
+ {{ getName(item) }}
|
|
|
+ </div>
|
|
|
</scroll-view>
|
|
|
<scroll-view
|
|
|
:style="{ height: `calc( 100vh - ${fixedTop}px - ${barHeight}px + 44px )` }"
|
|
|
:scroll-y="scrollEnabled"
|
|
|
class="right-side"
|
|
|
+ scroll-anchoring
|
|
|
@scrolltolower="getMore"
|
|
|
+ @scrolltoupper="changeScroll"
|
|
|
+ @scroll="scrollEvent($event, 'right')"
|
|
|
>
|
|
|
<div class="right">
|
|
|
<sort-list :empty="empty" :loading="loading" :finish="finish" :top="`${fixedTop}px`">
|
|
|
@@ -39,7 +58,8 @@ export default {
|
|
|
menus: [],
|
|
|
activeKey: 0,
|
|
|
url: '/product/show',
|
|
|
- searchTop: -1
|
|
|
+ searchTop: -1,
|
|
|
+ scrollId: ''
|
|
|
};
|
|
|
},
|
|
|
mixins: [searchList],
|
|
|
@@ -64,7 +84,7 @@ export default {
|
|
|
listQuery() {
|
|
|
return {
|
|
|
productSort: this.sort,
|
|
|
- customCateId: this.customCateId,
|
|
|
+ customCateId: this.activeKey || '',
|
|
|
query: JSON.stringify({
|
|
|
vendorInfoId: this.vendorInfo.id
|
|
|
})
|
|
|
@@ -92,8 +112,14 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
- changeCustomCate(e) {
|
|
|
- this.activeKey = e.detail;
|
|
|
+ changeCustomCate(id) {
|
|
|
+ this.$emit('goTop');
|
|
|
+ this.activeKey = id;
|
|
|
+ this.scrollId = 'cate_' + id;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.scrollId = '';
|
|
|
+ }, 200);
|
|
|
+
|
|
|
this.refreash();
|
|
|
},
|
|
|
getMore() {
|
|
|
@@ -101,6 +127,23 @@ export default {
|
|
|
this.page++;
|
|
|
this.getData();
|
|
|
}
|
|
|
+ },
|
|
|
+ changeScroll() {
|
|
|
+ this.$emit('changeMainScroll', true);
|
|
|
+ },
|
|
|
+ scrollEvent(event, type = 'left') {
|
|
|
+ if (event.detail.scrollTop > 0) {
|
|
|
+ this.$emit('changeMainScroll', false);
|
|
|
+ } else {
|
|
|
+ this.$emit('changeMainScroll', true);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (type === 'right') {
|
|
|
+ this.scrollId = 'cate_' + this.activeKey;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.scrollId = '';
|
|
|
+ }, 200);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
@@ -117,9 +160,6 @@ export default {
|
|
|
}
|
|
|
.left-side {
|
|
|
width: 121px;
|
|
|
- --sidebar-padding: 20px;
|
|
|
- --sidebar-selected-border-color: transparent;
|
|
|
- --sidebar-selected-font-weight: bolder;
|
|
|
background: @bg;
|
|
|
flex-shrink: 0;
|
|
|
position: sticky;
|
|
|
@@ -128,6 +168,30 @@ export default {
|
|
|
width: 121px;
|
|
|
}
|
|
|
|
|
|
+ .left-side-item {
|
|
|
+ padding: 20px 20px;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #000000;
|
|
|
+ line-height: 20px;
|
|
|
+
|
|
|
+ &.active {
|
|
|
+ color: #ffa526;
|
|
|
+ font-weight: bold;
|
|
|
+ background: #fff;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ &::before {
|
|
|
+ content: '';
|
|
|
+ position: absolute;
|
|
|
+ left: 12px;
|
|
|
+ top: 20px;
|
|
|
+ bottom: 20px;
|
|
|
+ width: 2px;
|
|
|
+ background-color: #ffa526;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.van-sidebar-item--selected {
|
|
|
position: relative;
|
|
|
&::before {
|