|
|
@@ -54,9 +54,9 @@ import product from '../../mixins/product';
|
|
|
import list from '../../mixins/list';
|
|
|
import search from '../../mixins/search';
|
|
|
export default {
|
|
|
- name: 'Search',
|
|
|
+ name: 'productSearch',
|
|
|
components: { ProductInfo },
|
|
|
- inject: ['bar'],
|
|
|
+ inject: ['bar', 'setKeeps', 'scrollWrapper', 'changeScroll'],
|
|
|
mixins: [product, list, search],
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -67,9 +67,15 @@ export default {
|
|
|
type: '',
|
|
|
source: '',
|
|
|
minterId: '',
|
|
|
- url: '/collection/all'
|
|
|
+ url: '/collection/all',
|
|
|
+ scrollTop: 0
|
|
|
};
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ isSearch() {
|
|
|
+ this.changeScroll(0);
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted() {
|
|
|
if (this.$route.query.type) {
|
|
|
this.type = this.$route.query.type;
|
|
|
@@ -94,6 +100,21 @@ export default {
|
|
|
search: this.search
|
|
|
};
|
|
|
}
|
|
|
+ },
|
|
|
+ activated() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.changeScroll(this.scrollTop);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ beforeRouteLeave(to, from, next) {
|
|
|
+ if (!to.meta.menuPage) {
|
|
|
+ this.scrollTop = this.scrollWrapper.value.scrollTop;
|
|
|
+ this.setKeeps(['productSearch']);
|
|
|
+ } else {
|
|
|
+ this.scrollTop = 0;
|
|
|
+ this.setKeeps([]);
|
|
|
+ }
|
|
|
+ next();
|
|
|
}
|
|
|
};
|
|
|
</script>
|