|
|
@@ -66,18 +66,21 @@
|
|
|
table.api-params-table
|
|
|
tbody
|
|
|
tr
|
|
|
- th 错误码
|
|
|
+ th.center 错误码
|
|
|
th 描述
|
|
|
tr(v-for="(value, code) in route.responses")
|
|
|
- td {{code}}
|
|
|
- td {{value.description}}
|
|
|
+ td.center {{code}}
|
|
|
+ td
|
|
|
+ pre.in-cell(v-if="isJsonString(value.description)")
|
|
|
+ code {{formatJsonString(value.description)}}
|
|
|
+ span(v-else) {{value.description}}
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
import Vue from 'vue'
|
|
|
import ParamsTable from './ParamsTable.vue'
|
|
|
-import { formatApiDocToRoutes } from '../helpers/apiDocHelper'
|
|
|
+import { formatApiDocToRoutes, isJsonString, formatJsonString } from '../helpers/apiDocHelper'
|
|
|
|
|
|
export default Vue.extend({
|
|
|
name: 'ApiDoc',
|
|
|
@@ -104,6 +107,11 @@ export default Vue.extend({
|
|
|
routes(): any[] {
|
|
|
return formatApiDocToRoutes(this.data)
|
|
|
}
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ isJsonString,
|
|
|
+ formatJsonString
|
|
|
}
|
|
|
})
|
|
|
</script>
|
|
|
@@ -156,6 +164,18 @@ export default Vue.extend({
|
|
|
|
|
|
pre {
|
|
|
max-height: 240px;
|
|
|
+
|
|
|
+ &.in-cell {
|
|
|
+ max-width: calc(100vw - 10rem);
|
|
|
+ max-height: 112px;
|
|
|
+ padding: 1em;
|
|
|
+ background: #fafafa;
|
|
|
+
|
|
|
+ code {
|
|
|
+ background: inherit;
|
|
|
+ white-space: inherit;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
h2 {
|