feat: 终端头部功能.

This commit is contained in:
lijiahang
2024-01-08 19:27:44 +08:00
parent 918ce861d3
commit d1fb64a050
9 changed files with 228 additions and 71 deletions

View File

@@ -2,7 +2,8 @@ import { useClipboard } from '@vueuse/core';
import { Message } from '@arco-design/web-vue';
export default function useCopy() {
const { isSupported, copy: c, text, copied } = useClipboard();
const { copy: c } = useClipboard();
// 复制
const copy = async (value: string | undefined, tips = `${value} 已复制`) => {
try {
if (!value) {
@@ -16,10 +17,12 @@ export default function useCopy() {
Message.error('复制失败');
}
};
// 获取剪切板内容
const readText = () => {
return navigator.clipboard.readText();
};
return {
isSupported,
copy,
text,
copied
readText,
};
}