测试报告下拉列表路由跳转

This commit is contained in:
shiziyuan9527 2020-03-10 15:35:25 +08:00
parent 145b478545
commit 468491bffe
3 changed files with 14 additions and 10 deletions

View File

@ -5,7 +5,7 @@
{{$t('load_test.recent')}} {{$t('load_test.recent')}}
</div> </div>
<el-menu-item :key="p.id" v-for="p in recentReports" <el-menu-item :key="p.id" v-for="p in recentReports"
:index="'/report/' + p.id" :route="{name:'report', params:{projectId:p.id, projectName:p.name}}"> :index="'/reportView/' + p.id" :route="{path: '/reportView/' + p.id}">
{{ p.name }} {{ p.name }}
</el-menu-item> </el-menu-item>
</el-menu> </el-menu>

View File

@ -91,6 +91,17 @@
this.reportId = this.$route.path.split('/')[2]; this.reportId = this.$route.path.split('/')[2];
this.initBreadcrumb(); this.initBreadcrumb();
}, },
watch: {
'$route'(to) {
let reportId = to.path.split('/')[2]; // find testId
this.$get("report/test/pro/info/" + reportId, response => {
let data = response.data;
this.reportName = data.name;
this.testName = data.testName;
this.projectName = data.projectName;
});
}
}
} }
</script> </script>

View File

@ -119,16 +119,9 @@ const router = new VueRouter({
}, },
{ {
path: "/reportView/:reportId", path: "/reportView/:reportId",
name: "ReportView", name: "reportView",
components: { components: {
content: ReportView content: ReportView
},
props: {
content: (route) => {
return {
...route.params
}
}
} }
}, },
] ]