feat: 复制

This commit is contained in:
dap 2024-12-18 17:15:53 +08:00
parent 8702d1ddfe
commit 9a259642af

View File

@ -10,13 +10,15 @@ import { Fallback, useVbenModal, VbenAvatar } from '@vben/common-ui';
import { DictEnum } from '@vben/constants'; import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import { useEventListener } from '@vueuse/core'; import { CopyOutlined } from '@ant-design/icons-vue';
import { useClipboard, useEventListener } from '@vueuse/core';
import { import {
Card, Card,
Divider, Divider,
Dropdown, Dropdown,
Menu, Menu,
MenuItem, MenuItem,
message,
Modal, Modal,
Skeleton, Skeleton,
Space, Space,
@ -344,6 +346,12 @@ function handleUpdateAssignee(userList: User[]) {
}, },
}); });
} }
const { copy } = useClipboard();
async function handleCopy(text: string) {
await copy(text);
message.success('复制成功');
}
</script> </script>
<template> <template>
@ -351,10 +359,15 @@ function handleUpdateAssignee(userList: User[]) {
v-if="task" v-if="task"
:body-style="{ overflowY: 'auto', height: '100%' }" :body-style="{ overflowY: 'auto', height: '100%' }"
:loading="loading" :loading="loading"
:title="`编号: ${task.id}`"
class="thin-scrollbar flex-1 overflow-y-hidden" class="thin-scrollbar flex-1 overflow-y-hidden"
size="small" size="small"
> >
<template #title>
<div class="flex items-center gap-2">
<div>编号: {{ task.id }}</div>
<CopyOutlined class="cursor-pointer" @click="handleCopy(task.id)" />
</div>
</template>
<template #extra> <template #extra>
<a-button size="small" @click="() => handleLoadInfo(task)"> <a-button size="small" @click="() => handleLoadInfo(task)">
<div class="flex items-center justify-center"> <div class="flex items-center justify-center">