feat(new-tool): IPv4 subnet calculator

This commit is contained in:
Corentin Thomasset 2023-03-28 23:31:11 +02:00 committed by Corentin THOMASSET
parent 47948dd343
commit c339ab3551
7 changed files with 1828 additions and 1608 deletions

View file

@ -0,0 +1,35 @@
<template>
<n-tooltip trigger="hover">
<template #trigger>
<span class="ip" @click="handleClick">{{ ip }}</span>
</template>
{{ tooltipText }}
</n-tooltip>
</template>
<script setup lang="ts">
import { useClipboard } from '@vueuse/core';
import { ref, toRefs } from 'vue';
const props = withDefaults(defineProps<{ ip?: string }>(), { ip: '' });
const { ip } = toRefs(props);
const initialText = 'Copy to clipboard';
const tooltipText = ref(initialText);
const { copy } = useClipboard({ source: ip });
function handleClick() {
copy();
tooltipText.value = 'Copied!';
setTimeout(() => (tooltipText.value = initialText), 1000);
}
</script>
<style scoped lang="less">
.ip {
font-family: monospace;
cursor: pointer;
}
</style>