diff --git a/src/components/chatui.vue b/src/components/chatui.vue index 5cfee5c..88f6898 100644 --- a/src/components/chatui.vue +++ b/src/components/chatui.vue @@ -6,7 +6,7 @@
{{ `${msg.from.split('-')[0]} ${msg.timestampString}` }}
{{ msg.msg }} - +
@@ -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 + "/"; diff --git a/src/views/chat.vue b/src/views/chat.vue index 9df9626..eb065fc 100644 --- a/src/views/chat.vue +++ b/src/views/chat.vue @@ -3,7 +3,7 @@ @@ -98,6 +98,11 @@ const message = useMessage() // const modal = useModal(); 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 wsBaseUrl = 'ws' + "://" + location.hostname + ":" + serverPort;