研发图纸文件管理系统-前端项目
he wei
2025-03-13 ec8d9f802eac6841165425b228ef56474636fa9a
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
<template>
  <a-table :data-source="apiSource" :pagination="false">
    <h2 v-if="title" style="margin: 0 16px 0" slot="title">{{title}}</h2>
    <a-table-column width="20%" data-index="param" title="参数">
      <div slot-scope="text" v-html="text"></div>
    </a-table-column>
    <a-table-column width="50%" data-index="desc" title="说明">
      <div slot-scope="text" v-html="text"></div>
    </a-table-column>
    <a-table-column v-if="isApi" width="15%" data-index="type" title="类型">
      <div slot-scope="text" v-html="text"></div>
    </a-table-column>
    <a-table-column v-if="isApi" width="15%" data-index="default" title="默认值">
      <div slot-scope="text" v-html="text"></div>
    </a-table-column>
    <a-table-column v-if="!isApi" width="30%" data-index="callback" title="回调函数">
      <div slot-scope="text" v-html="text"></div>
    </a-table-column>
  </a-table>
</template>
 
<script>
  export default {
    name: 'ApiTable',
    props: {
      title: {
        type: String,
        default: 'API'
      },
      type: {
        type: String,
        default: 'api',
        validator(value) {
          return ['api', 'event'].includes(value)
        }
      },
      apiSource: Array
    },
    computed: {
      isApi() {
        return this.type === 'api'
      }
    }
  }
</script>
 
<style scoped>
 
</style>