Commit 583f7e8d6d7929a9562d24aa3c27723782941294

Authored by ww
2 parents 772d09b2 f32bc2c4

merge: merge code && resolve conflict

1 1 <script lang="ts" setup>
2 2 import { BasicTable, useTable } from '/@/components/Table';
3 3 import { list, topicTableColumn } from './topic';
  4 + import { unref } from 'vue';
  5 + import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
  6 + import { useMessage } from '/@/hooks/web/useMessage';
4 7
  8 + const { createMessage } = useMessage();
5 9 const [register] = useTable({
6 10 title: 'Topic',
7 11 showIndexColumn: false,
... ... @@ -10,10 +14,51 @@
10 14 bordered: true,
11 15 showTableSetting: true,
12 16 });
  17 + const handeleCopy = (e) => {
  18 + const { isSuccessRef } = useCopyToClipboard(JSON.parse(JSON.stringify(unref(e), null, 2)));
  19 + unref(isSuccessRef);
  20 + createMessage.success('复制成功!');
  21 + };
13 22 </script>
14 23
15 24 <template>
16 25 <section class="bg-gray-100 p-4 dark:bg-dark-900 w-full h-full">
17   - <BasicTable @register="register" />
  26 + <BasicTable @register="register">
  27 + <template #function="{ record }">
  28 + <a-tooltip :title="record.function">
  29 + <a-button type="text" class="ml-2" @click="handeleCopy(record.function)">
  30 + <span>{{ record.function.slice(0, 13) }}</span>
  31 + </a-button>
  32 + </a-tooltip>
  33 + </template>
  34 + <template #release="{ record }">
  35 + <a-tooltip :title="record.release">
  36 + <a-button type="text" class="ml-2" @click="handeleCopy(record.release)">
  37 + <span>{{ record.release.slice(0, 30) }}</span>
  38 + </a-button>
  39 + </a-tooltip>
  40 + </template>
  41 + <template #subscribe="{ record }">
  42 + <a-tooltip :title="record.subscribe">
  43 + <a-button type="text" class="ml-2" @click="handeleCopy(record.subscribe)">
  44 + <span>{{ record.subscribe.slice(0, 30) }}</span>
  45 + </a-button>
  46 + </a-tooltip>
  47 + </template>
  48 + <template #platform="{ record }">
  49 + <a-tooltip :title="record.platform">
  50 + <a-button type="text" class="ml-2" @click="handeleCopy(record.platform)">
  51 + <span>{{ record.platform }}</span>
  52 + </a-button>
  53 + </a-tooltip>
  54 + </template>
  55 + <template #device="{ record }">
  56 + <a-tooltip :title="record.device">
  57 + <a-button type="text" class="ml-2" @click="handeleCopy(record.device)">
  58 + <span>{{ record.device }}</span>
  59 + </a-button>
  60 + </a-tooltip>
  61 + </template>
  62 + </BasicTable>
18 63 </section>
19 64 </template>
... ...
... ... @@ -29,26 +29,31 @@ export const topicTableColumn: BasicColumn[] = [
29 29 title: '功能',
30 30 dataIndex: 'function',
31 31 width: 100,
  32 + slots: { customRender: 'function' },
32 33 },
33 34 {
34 35 title: '发布主题',
35 36 dataIndex: 'release',
36 37 width: 120,
  38 + slots: { customRender: 'release' },
37 39 },
38 40 {
39 41 title: '订阅主题',
40 42 dataIndex: 'subscribe',
41 43 width: 120,
  44 + slots: { customRender: 'subscribe' },
42 45 },
43 46 {
44 47 title: '平台',
45 48 dataIndex: 'platform',
46 49 width: 30,
  50 + slots: { customRender: 'platform' },
47 51 },
48 52 {
49 53 title: '设备',
50 54 dataIndex: 'device',
51 55 width: 30,
  56 + slots: { customRender: 'device' },
52 57 },
53 58 ];
54 59
... ...