mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-24 16:56:14 -04:00
chore: components base
This commit is contained in:
parent
64c92a661c
commit
25a8659786
13 changed files with 821 additions and 19 deletions
15
src/composable/copy.ts
Normal file
15
src/composable/copy.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { useClipboard } from '@vueuse/core';
|
||||
import { useMessage } from 'naive-ui';
|
||||
import type { Ref } from 'vue';
|
||||
|
||||
export function useCopy({ source, text = 'Copied to the clipboard' }: { source: Ref; text?: string }) {
|
||||
const { copy } = useClipboard({ source });
|
||||
const message = useMessage();
|
||||
|
||||
return {
|
||||
async copy() {
|
||||
await copy();
|
||||
message.success(text);
|
||||
},
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue