mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-11-03 13:33:21 +00:00
feat(new tool): emoji picker (#551)
This commit is contained in:
committed by
Corentin Thomasset
parent
dfa1ba8554
commit
93f7cf0e98
@@ -1,14 +1,14 @@
|
||||
import { type MaybeRef, get, useClipboard } from '@vueuse/core';
|
||||
import { useMessage } from 'naive-ui';
|
||||
|
||||
export function useCopy({ source, text = 'Copied to the clipboard' }: { source: MaybeRef<unknown>; text?: string }) {
|
||||
const { copy } = useClipboard({ source: computed(() => String(get(source))) });
|
||||
export function useCopy({ source, text = 'Copied to the clipboard' }: { source?: MaybeRef<unknown>; text?: string } = {}) {
|
||||
const { copy } = useClipboard(source ? { source: computed(() => String(get(source))) } : {});
|
||||
const message = useMessage();
|
||||
|
||||
return {
|
||||
async copy() {
|
||||
async copy(content?: string, { notificationMessage }: { notificationMessage?: string } = {}) {
|
||||
await copy();
|
||||
message.success(text);
|
||||
message.success(notificationMessage ?? text);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user