mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-25 17:26:15 -04:00
17 lines
542 B
Vue
17 lines
542 B
Vue
<script setup lang="ts">
|
|
import { useCopy } from '@/composable/copy';
|
|
|
|
const props = withDefaults(defineProps<{ value?: string }>(), { value: '' });
|
|
const { value } = toRefs(props);
|
|
|
|
const initialText = 'Copy to clipboard';
|
|
|
|
const { copy, isJustCopied } = useCopy({ source: value, createToast: false });
|
|
const tooltipText = computed(() => isJustCopied.value ? 'Copied!' : initialText);
|
|
</script>
|
|
|
|
<template>
|
|
<c-tooltip :tooltip="tooltipText">
|
|
<span cursor-pointer font-mono @click="copy()">{{ value }}</span>
|
|
</c-tooltip>
|
|
</template>
|