doc-act-list.vue
1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<template>
<Collapse accordion v-model="openAct" @on-change="actChange">
<Panel :name="act.name" v-for="act in list" :key="act.name">
{{act.name}}({{act.desc}})
<div slot="content" v-if="act.__rendered">
<h2>接口路径</h2>
<div class="path">{{act.path}}</div>
<h2>提交参数</h2>
<Table :columns="reqColumns" :data="act.paramInfo"></Table>
<h2>返回参数</h2>
<Table :columns="resColumns" :data="[act.responseInfo]"></Table>
</div>
</Panel>
</Collapse>
</template>
<script>
export default {
name: 'DocActList',
props: {
list: Array
},
data() {
return {
openAct: [],
reqColumns: [{
title: '名称',
key: 'name'
}, {
title: '类型',
key: 'paramType'
}, {
title: '必填',
key: 'required'
}, {
title: '默认值',
key: 'defaultValue'
}, {
title: '描述',
key: 'desc'
}],
resColumns: [{
title: '类型',
key: 'clazz'
}, {
title: '描述',
key: 'desc'
}],
reqData: [],
resData: []
};
},
methods: {
actChange(open) {
let act = this.list.find(a => a.name === open[0]);
if (act) {
act.__rendered = true;
}
}
}
};
</script>
<style lang="scss">
.path {
margin-bottom: 10px;
}
</style>