|
|
@@ -86,6 +86,8 @@ import http from '@/plugins/http';
|
|
|
//获取列表
|
|
|
import useList from '@/plugins/list';
|
|
|
import { reject } from 'q';
|
|
|
+import { mapState } from 'vuex';
|
|
|
+import { throwStatement } from '@babel/types';
|
|
|
export default {
|
|
|
setup() {
|
|
|
let beforeData = {
|
|
|
@@ -171,9 +173,16 @@ export default {
|
|
|
inject: ['setKeeps', 'scrollWrapper', 'changeScroll'],
|
|
|
data() {
|
|
|
return {
|
|
|
- scrollTop: 0
|
|
|
+ scrollTop: 0,
|
|
|
+ isFreash: false
|
|
|
};
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ this.emitter.on('listRefreash', () => {
|
|
|
+ console.log('刷新');
|
|
|
+ this.isFreash = true;
|
|
|
+ });
|
|
|
+ },
|
|
|
beforeRouteEnter(to, from) {
|
|
|
fromRoute = from;
|
|
|
},
|
|
|
@@ -206,11 +215,15 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
activated() {
|
|
|
+ if (this.isFreash) {
|
|
|
+ this.getData(true);
|
|
|
+ }
|
|
|
this.$nextTick(() => {
|
|
|
this.changeScroll(this.scrollTop);
|
|
|
});
|
|
|
},
|
|
|
beforeRouteLeave(to, from, next) {
|
|
|
+ this.isFreash = false;
|
|
|
if (to.name === 'productDetail') {
|
|
|
this.scrollTop = this.scrollWrapper.scrollTop;
|
|
|
this.setKeeps(['prefixNameList']);
|