路由配置中,点击Mock数据可以直接修改文件内容

This commit is contained in:
dongzp 2026-06-09 14:21:35 +08:00
parent 2a7d4efa59
commit 03c2c83f68
2 changed files with 11 additions and 2 deletions

View File

@ -84,7 +84,7 @@
</el-table-column> </el-table-column>
<el-table-column label="Mock 文件路径" min-width="240" show-overflow-tooltip> <el-table-column label="Mock 文件路径" min-width="240" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.filePath }}</span> <a href="javascript:void(0)" style="color:#409EFF;cursor:pointer;" @click="openMockFileFromRoute(scope.row)">{{ scope.row.filePath }}</a>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="返回状态码" width="120" align="center"> <el-table-column label="返回状态码" width="120" align="center">
@ -842,6 +842,15 @@
}; };
this.mockFileDialog.visible = true; this.mockFileDialog.visible = true;
}, },
openMockFileFromRoute: function (routeRow) {
var filePath = routeRow.filePath || "";
var mockFile = this.mockFiles.find(function (f) { return f.filePath === filePath; });
if (!mockFile) {
this.$message.warning("未找到对应的 Mock 文件:" + filePath);
return;
}
this.openMockFileDialogForEdit(mockFile);
},
openMockFileDialogForCopy: function (item) { openMockFileDialogForCopy: function (item) {
this.mockFileDialog.mode = "copy"; this.mockFileDialog.mode = "copy";
this.mockFileDialog.form = { this.mockFileDialog.form = {

View File

@ -1 +1 @@
{"code":0,"msg":"ok"} {"code":0,"msg":"3"}