refactor: 修改 Header 上注册事件的方式

This commit is contained in:
Captain.B 2020-09-03 10:02:51 +08:00
parent 5b750fe55f
commit ec931d038c
3 changed files with 28 additions and 18 deletions

View File

@ -87,13 +87,17 @@ export default {
}
}
},
methods: {
registerEvents() {
ApiEvent.$on(LIST_CHANGE, () => {
this.$refs.projectRecent.recent();
this.$refs.testRecent.recent();
this.$refs.reportRecent.recent();
});
}
},
mounted() {
let self = this;
ApiEvent.$on(LIST_CHANGE, () => {
self.$refs.projectRecent.recent();
self.$refs.testRecent.recent();
self.$refs.reportRecent.recent();
});
this.registerEvents();
}
}

View File

@ -95,13 +95,17 @@ export default {
}
}
},
methods: {
registerEvents() {
PerformanceEvent.$on(LIST_CHANGE, () => {
this.$refs.projectRecent.recent();
this.$refs.testRecent.recent();
this.$refs.reportRecent.recent();
});
}
},
mounted() {
let self = this;
PerformanceEvent.$on(LIST_CHANGE, () => {
self.$refs.projectRecent.recent();
self.$refs.testRecent.recent();
self.$refs.reportRecent.recent();
});
this.registerEvents();
}
}

View File

@ -100,12 +100,7 @@ export default {
},
mounted() {
this.init();
let self = this;
TrackEvent.$on(LIST_CHANGE, () => {
self.$refs.projectRecent.recent();
self.$refs.planRecent.recent();
self.$refs.caseRecent.recent();
});
this.registerEvents();
},
methods: {
reload() {
@ -132,6 +127,13 @@ export default {
this.testCaseEditPath = path;
this.reload();
}
},
registerEvents() {
TrackEvent.$on(LIST_CHANGE, () => {
this.$refs.projectRecent.recent();
this.$refs.planRecent.recent();
this.$refs.caseRecent.recent();
});
}
}
}