TopicPanel.vue
2.26 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
<script lang="ts" setup>
import { BasicTable, useTable } from '/@/components/Table';
import { list, topicTableColumn } from './topic';
import { unref } from 'vue';
import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
const [register] = useTable({
title: 'Topic',
showIndexColumn: false,
dataSource: list,
columns: topicTableColumn,
bordered: true,
showTableSetting: true,
});
const handeleCopy = (e) => {
const { isSuccessRef } = useCopyToClipboard(JSON.parse(JSON.stringify(unref(e), null, 2)));
unref(isSuccessRef);
createMessage.success('复制成功!');
};
</script>
<template>
<section class="bg-gray-100 p-4 dark:bg-dark-900 w-full h-full">
<BasicTable @register="register">
<template #function="{ record }">
<a-tooltip :title="record.function">
<a-button type="text" class="ml-2" @click="handeleCopy(record.function)">
<span>{{ record.function.slice(0, 13) }}</span>
</a-button>
</a-tooltip>
</template>
<template #release="{ record }">
<a-tooltip :title="record.release">
<a-button type="text" class="ml-2" @click="handeleCopy(record.release)">
<span>{{ record.release.slice(0, 30) }}</span>
</a-button>
</a-tooltip>
</template>
<template #subscribe="{ record }">
<a-tooltip :title="record.subscribe">
<a-button type="text" class="ml-2" @click="handeleCopy(record.subscribe)">
<span>{{ record.subscribe.slice(0, 30) }}</span>
</a-button>
</a-tooltip>
</template>
<template #platform="{ record }">
<a-tooltip :title="record.platform">
<a-button type="text" class="ml-2" @click="handeleCopy(record.platform)">
<span>{{ record.platform }}</span>
</a-button>
</a-tooltip>
</template>
<template #device="{ record }">
<a-tooltip :title="record.device">
<a-button type="text" class="ml-2" @click="handeleCopy(record.device)">
<span>{{ record.device }}</span>
</a-button>
</a-tooltip>
</template>
</BasicTable>
</section>
</template>