|
|
@@ -6,7 +6,6 @@
|
|
|
<img src="@assets/icon-sosuo.png" alt="" @click="goSearch" class="search" />
|
|
|
</div>
|
|
|
<van-tabs
|
|
|
- v-if="!title"
|
|
|
v-model:active="sort"
|
|
|
:ellipsis="false"
|
|
|
line-width="16"
|
|
|
@@ -56,8 +55,9 @@ import ProductInfo from '../../components/product/productInfo.vue';
|
|
|
import product from '../../mixins/product';
|
|
|
import list from '../../mixins/list';
|
|
|
export default {
|
|
|
+ name: 'productList',
|
|
|
components: { ProductInfo },
|
|
|
- inject: ['bar'],
|
|
|
+ inject: ['bar', 'setKeeps', 'scrollWrapper', 'changeScroll'],
|
|
|
mixins: [product, list],
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -88,7 +88,8 @@ export default {
|
|
|
],
|
|
|
url: '/collection/all',
|
|
|
title: '',
|
|
|
- salable: false
|
|
|
+ salable: false,
|
|
|
+ scrollTop: 0
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -123,7 +124,7 @@ export default {
|
|
|
minterId: this.minterId,
|
|
|
salable: this.salable || ''
|
|
|
},
|
|
|
- sort: this.sortOptions[this.title] || this.sort
|
|
|
+ sort: this.sort === 'id,desc' ? this.sortOptions[this.title] || this.sort : this.sort
|
|
|
};
|
|
|
},
|
|
|
goSearch() {
|
|
|
@@ -136,6 +137,21 @@ export default {
|
|
|
}
|
|
|
this.$router.push(url);
|
|
|
}
|
|
|
+ },
|
|
|
+ activated() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.changeScroll(this.scrollTop);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ beforeRouteLeave(to, from, next) {
|
|
|
+ if (!to.meta.menuPage) {
|
|
|
+ this.scrollTop = this.scrollWrapper.value.scrollTop;
|
|
|
+ this.setKeeps(['productList']);
|
|
|
+ } else {
|
|
|
+ this.scrollTop = 0;
|
|
|
+ this.setKeeps(['productList'], false);
|
|
|
+ }
|
|
|
+ next();
|
|
|
}
|
|
|
};
|
|
|
</script>
|