|
@@ -44,10 +44,11 @@
|
|
|
|
|
|
</div>
|
|
|
</el-alert> -->
|
|
|
- <!-- <el-icon class="copy-icon" @click="copyCode">
|
|
|
+ <!-- <el-icon class="copy-icon" @click="copyCode">
|
|
|
<DocumentCopy />
|
|
|
</el-icon> -->
|
|
|
- <pre><code ref="codeElement" >{{ postExample }}</code></pre>
|
|
|
+ <!-- <pre><code ref="codeElement">{{ postExample }}</code></pre> -->
|
|
|
+ <pre><code ref="codeElement" v-html="highlightHtml(postExample, 'json')"></code></pre>
|
|
|
</el-collapse-item>
|
|
|
</el-collapse>
|
|
|
</el-card>
|
|
@@ -74,8 +75,8 @@
|
|
|
</el-table>
|
|
|
|
|
|
<h3>请求示例</h3>
|
|
|
- <pre><code>{{ requestExample }}</code></pre>
|
|
|
-
|
|
|
+ <!-- <pre><code>{{ requestExample }}</code></pre> -->
|
|
|
+ <pre><code v-html="highlightHtml(requestExample, 'json')"></code></pre>
|
|
|
<h3>响应结果 (Response - JSON)</h3>
|
|
|
<el-table :data="responseParams" border style="width: 100%">
|
|
|
<el-table-column prop="fieldName" label="字段名" />
|
|
@@ -98,7 +99,8 @@
|
|
|
</el-table>
|
|
|
|
|
|
<h3>响应示例</h3>
|
|
|
- <pre><code>{{ responseExample }}</code></pre>
|
|
|
+ <!-- <pre><code>{{ responseExample }}</code></pre> -->
|
|
|
+ <pre><code v-html="highlightHtml(responseExample, 'json')"></code></pre>
|
|
|
</el-card>
|
|
|
</div>
|
|
|
<div v-if="queueId === '2'">
|
|
@@ -154,7 +156,8 @@
|
|
|
</el-table> -->
|
|
|
|
|
|
<h3>响应示例</h3>
|
|
|
- <pre><code>{{ responseExampleRelationship }}</code></pre>
|
|
|
+ <!-- <pre><code>{{ responseExampleRelationship }}</code></pre> -->
|
|
|
+ <pre><code v-html="highlightHtml(responseExampleRelationship, 'json')"></code></pre>
|
|
|
</el-card>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -163,6 +166,7 @@ import { ref, watch } from 'vue';
|
|
|
import { useRoute } from 'vue-router';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
import { DocumentCopy } from '@element-plus/icons-vue';
|
|
|
+import { highlightHtml } from "@/utils/highlight"
|
|
|
|
|
|
const route = useRoute();
|
|
|
let queueId = ref(route.params.id || '0'); // 默认值为 '0',表示简介
|
|
@@ -170,6 +174,8 @@ watch(() => route.params.id, (newId) => {
|
|
|
queueId.value = newId || '0';
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+
|
|
|
const headers = ref([
|
|
|
{
|
|
|
paramName: 'Content-Type',
|
|
@@ -243,7 +249,7 @@ const responseParams = ref([
|
|
|
{ fieldName: 'errorMsg', name: '错误信息', type: 'string', description: '请求失败时返回的错误描述信息。成功时为 null。' },
|
|
|
{ fieldName: 'requestId', name: '请求唯一ID', type: 'string', description: '对应请求头中的 request-id,用于追踪请求。' },
|
|
|
{ fieldName: 'data', name: '响应数据', type: 'Array<Object>', description: '成功时返回的数据对象数组。主要包含实体节点列表 (nodes)。' },
|
|
|
- { fieldName: 'data.key', name: '响应数据', type:'string', description: '第一层级key为nodes,即节点列表属性' },
|
|
|
+ { fieldName: 'data.key', name: '响应数据', type: 'string', description: '第一层级key为nodes,即节点列表属性' },
|
|
|
{ fieldName: 'data.value', name: '响应数据', type: 'Array<Object>', description: '第一层级value为nodes的值,即节点列表属性的值' }
|
|
|
]);
|
|
|
|
|
@@ -394,6 +400,7 @@ const responseExampleRelationship = ref(`{
|
|
|
font-size: 22px;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
+
|
|
|
h3 {
|
|
|
margin-top: 20px;
|
|
|
margin-bottom: 10px;
|
|
@@ -411,9 +418,11 @@ pre {
|
|
|
code {
|
|
|
font-family: 'Courier New', Courier, monospace;
|
|
|
}
|
|
|
+
|
|
|
.code-container {
|
|
|
position: relative;
|
|
|
}
|
|
|
+
|
|
|
.copy-icon {
|
|
|
position: absolute;
|
|
|
top: 10px;
|
|
@@ -423,33 +432,41 @@ code {
|
|
|
font-size: 18px;
|
|
|
color: #606266;
|
|
|
}
|
|
|
+
|
|
|
.copy-icon:hover {
|
|
|
color: #409eff;
|
|
|
}
|
|
|
+
|
|
|
.code-container pre code {
|
|
|
display: block;
|
|
|
}
|
|
|
|
|
|
.code-container pre code span.request-header {
|
|
|
- color: #1890ff; /* 请求头颜色 */
|
|
|
+ color: #1890ff;
|
|
|
+ /* 请求头颜色 */
|
|
|
}
|
|
|
|
|
|
.code-container pre code span.request-body {
|
|
|
- color: #333; /* 请求内容颜色 */
|
|
|
+ color: #333;
|
|
|
+ /* 请求内容颜色 */
|
|
|
}
|
|
|
+
|
|
|
.el-button {
|
|
|
position: absolute;
|
|
|
top: 10px;
|
|
|
right: 10px;
|
|
|
z-index: 1;
|
|
|
}
|
|
|
+
|
|
|
.mx-10 {
|
|
|
- margin:10px 0
|
|
|
+ margin: 10px 0
|
|
|
}
|
|
|
+
|
|
|
.mx-20 {
|
|
|
- margin:20px 0
|
|
|
+ margin: 20px 0
|
|
|
}
|
|
|
+
|
|
|
.text-bold {
|
|
|
- font-weight: bold;
|
|
|
+ font-weight: bold;
|
|
|
}
|
|
|
</style>
|