mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-22 15:56:15 -04:00
26 lines
811 B
Vue
26 lines
811 B
Vue
<script setup lang="ts">
|
|
import { useVModel } from '@vueuse/core';
|
|
import { useCopy } from '@/composable/copy';
|
|
|
|
const props = defineProps<{ value: string }>();
|
|
const emit = defineEmits(['update:value']);
|
|
|
|
const value = useVModel(props, 'value', emit);
|
|
const { copy, isJustCopied } = useCopy({ source: value, createToast: false });
|
|
const tooltipText = computed(() => isJustCopied.value ? 'Copied!' : 'Copy to clipboard');
|
|
</script>
|
|
|
|
<template>
|
|
<c-input-text v-model:value="value">
|
|
<template #suffix>
|
|
<n-tooltip trigger="hover">
|
|
<template #trigger>
|
|
<c-button circle variant="text" size="small" @click="copy()">
|
|
<icon-mdi-content-copy />
|
|
</c-button>
|
|
</template>
|
|
{{ tooltipText }}
|
|
</n-tooltip>
|
|
</template>
|
|
</c-input-text>
|
|
</template>
|