fix: 切换项目测试计划和评审详情页面不更新

This commit is contained in:
chenjianxing 2021-06-07 15:19:56 +08:00 committed by jianxing
parent 5f2ef8198f
commit 7dc83a4591
4 changed files with 20 additions and 1 deletions

View File

@ -97,6 +97,8 @@ export default {
this.$post("/user/update/current", {id: this.userId, lastProjectId: projectId}, (response) => {
saveLocalStorage(response);
this.currentProjectId = projectId;
this.$EventBus.$emit('projectChange');
//
this.reload();

View File

@ -86,6 +86,13 @@ export default {
this.getTestPlans();
}
},
created() {
this.$EventBus.$on('projectChange', () => {
if (this.$route.name === 'planView') {
this.$router.push('/track/plan/all');
}
});
},
mounted() {
this.getTestPlans();
},

View File

@ -83,6 +83,13 @@ export default {
return `var(--primary_color)`
}
},
created() {
this.$EventBus.$on('projectChange', () => {
if (this.$route.name === 'testCaseReviewView') {
this.$router.push('/track/review/all');
}
});
},
mounted() {
this.initData();
this.openTestCaseEdit(this.$route.path);

View File

@ -76,7 +76,10 @@ Vue.directive('preventReClick', {
}
})
}
})
});
// 添加全局事件总线
Vue.prototype.$EventBus = new Vue();
new Vue({
el: '#app',