chore: components base

This commit is contained in:
Corentin Thomasset 2022-04-04 00:24:45 +02:00
parent 64c92a661c
commit 25a8659786
No known key found for this signature in database
GPG key ID: DBD997E935996158
13 changed files with 821 additions and 19 deletions

15
src/composable/copy.ts Normal file
View 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);
},
};
}