mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-07-23 23:29:37 +02:00
* feat(ipv4-range-expander): expands a given IPv4 start and end address to a valid IPv4 subnet * feat(ipv4-range-expander): remove old component copyable-ip-like.vue * feat(ipv4-range-expander): fix sonar findings * feat(ipv4-range-expander): changes due to review * feat(ipv4-range-expander): only show n-alert if both ipv4 addresses are valid
35 lines
781 B
Vue
35 lines
781 B
Vue
<template>
|
|
<n-tooltip trigger="hover">
|
|
<template #trigger>
|
|
<span class="value" @click="handleClick">{{ value }}</span>
|
|
</template>
|
|
{{ tooltipText }}
|
|
</n-tooltip>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { useClipboard } from '@vueuse/core';
|
|
import { ref, toRefs } from 'vue';
|
|
|
|
const props = withDefaults(defineProps<{ value?: string }>(), { value: '' });
|
|
const { value } = toRefs(props);
|
|
|
|
const initialText = 'Copy to clipboard';
|
|
const tooltipText = ref(initialText);
|
|
|
|
const { copy } = useClipboard({ source: value });
|
|
|
|
function handleClick() {
|
|
copy();
|
|
tooltipText.value = 'Copied!';
|
|
|
|
setTimeout(() => (tooltipText.value = initialText), 1000);
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.value {
|
|
cursor: pointer;
|
|
font-family: monospace;
|
|
}
|
|
</style>
|