添加复制时提示

This commit is contained in:
539943419 committed 2024-07-20 21:16:10 +08:00
1 parent cf4297cc3c
commit 1780a0bb8b
2 files changed
+14 -2

No files matched your search

+8 -1
View File
@@ -6,7 +6,7 @@
<div class="message-title">{{ `${msg.from.split('-')[0]} ${msg.timestampString}` }}</div>
<div class="message-text" v-if="msg.type1 === 'text'">
<span>{{ msg.msg }}</span>
<n-icon :component="CopyOutline" class="message-text-copy" @click='toClipboard(msg.msg)' />
<n-icon :component="CopyOutline" class="message-text-copy" @click='_toClipboard(msg.msg)' />
</div>
<div v-if="msg.type1 === 'img'">
<span>
@@ -59,8 +59,15 @@ import { decrypt, decryptString, downloadFromUint8Array } from '../func/download
import { CubeOutline as DownloadIcon, CopyOutline } from '@vicons/ionicons5'
import fileSize2String from '@/func/fileSize2String'
import useClipboard from "vue-clipboard3";
import { useMessage } from "naive-ui";
const message = useMessage()
const { toClipboard } = useClipboard();
const _toClipboard = async (text) => {
await toClipboard(text)
message.info(`已复制 ${text.length < 10 ? text : text.substring(0,7) + '...'}`)
}
const setting = useSettingStore();
const serverPort = setting.serverPort;
const baseUrl = location.protocol + "//" + location.hostname + ":" + serverPort + "/";