feat: 终端头部功能.
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user