✨ sftp 操作日志.
This commit is contained in:
@@ -1,26 +1,29 @@
|
||||
import { useClipboard } from '@vueuse/core';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
|
||||
export default function useCopy() {
|
||||
const { copy: c } = useClipboard();
|
||||
// 复制
|
||||
const copy = async (value: string | undefined, tips: string | boolean = `${value} 已复制`) => {
|
||||
try {
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
await c(value);
|
||||
if (tips) {
|
||||
Message.success(tips as string);
|
||||
}
|
||||
} catch (e) {
|
||||
Message.error('复制失败');
|
||||
const { copy: c } = useClipboard();
|
||||
|
||||
// 复制
|
||||
export const copy = async (value: string | undefined, tips: string | boolean = `${value} 已复制`) => {
|
||||
try {
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
// 获取剪切板内容
|
||||
const readText = () => {
|
||||
return navigator.clipboard.readText();
|
||||
};
|
||||
await c(value);
|
||||
if (tips) {
|
||||
Message.success(tips as string);
|
||||
}
|
||||
} catch (e) {
|
||||
Message.error('复制失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 获取剪切板内容
|
||||
export const readText = () => {
|
||||
return navigator.clipboard.readText();
|
||||
};
|
||||
|
||||
export default function useCopy() {
|
||||
return {
|
||||
copy,
|
||||
readText,
|
||||
|
||||
Reference in New Issue
Block a user