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,14 +87,18 @@ export default {
}
}
},
mounted() {
let self = this;
methods: {
registerEvents() {
ApiEvent.$on(LIST_CHANGE, () => {
self.$refs.projectRecent.recent();
self.$refs.testRecent.recent();
self.$refs.reportRecent.recent();
this.$refs.projectRecent.recent();
this.$refs.testRecent.recent();
this.$refs.reportRecent.recent();
});
}
},
mounted() {
this.registerEvents();
}
}
</script>

View File

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

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();
});
}
}
}