From 1acb66317508943ad63eb6655561acbe5523365b Mon Sep 17 00:00:00 2001 From: Rasel Shikdar <103440692+raselshikdar@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:59:58 +0600 Subject: [PATCH] Update NoteCard.vue --- components/NoteCard.vue | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/components/NoteCard.vue b/components/NoteCard.vue index 9fcf5fc..7b984bb 100644 --- a/components/NoteCard.vue +++ b/components/NoteCard.vue @@ -6,39 +6,42 @@ interface Note { title: string content: string date: string - category: { - color: string - } } +// Define props for the note defineProps({ note: Object as PropType, }) -const copyToClipboard = (text: string) => { - navigator.clipboard.writeText(text).then(() => { - console.log('Copied to clipboard:', text) - }) +// Function to copy note content to clipboard +const copyToClipboard = async (text: string) => { + try { + await navigator.clipboard.writeText(text) + alert('Note copied to clipboard!') + } catch (err) { + console.error('Failed to copy: ', err) + } }