(text)
| 20 | } |
| 21 | |
| 22 | const copyToClipboard = async (text) => { |
| 23 | if (navigator.clipboard?.writeText) { |
| 24 | try { |
| 25 | await navigator.clipboard.writeText(text); |
| 26 | Toast.success({ |
| 27 | content: t('消息已复制到剪贴板'), |
| 28 | duration: 2, |
| 29 | }); |
| 30 | } catch (err) { |
| 31 | console.error('Clipboard API 复制失败:', err); |
| 32 | fallbackCopy(text); |
| 33 | } |
| 34 | } else { |
| 35 | fallbackCopy(text); |
| 36 | } |
| 37 | }; |
| 38 | |
| 39 | const fallbackCopy = (text) => { |
| 40 | try { |
no test coverage detected