2023-05-28 23:13:24 +02:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { v4 as generateUUID } from 'uuid';
|
|
|
|
import { useCopy } from '@/composable/copy';
|
|
|
|
import { computedRefreshable } from '@/composable/computedRefreshable';
|
|
|
|
|
|
|
|
const count = useStorage('uuid-generator:quantity', 1);
|
|
|
|
|
|
|
|
const [uuids, refreshUUIDs] = computedRefreshable(() =>
|
|
|
|
Array.from({ length: count.value }, () => generateUUID()).join('\n'),
|
|
|
|
);
|
|
|
|
|
|
|
|
const { copy } = useCopy({ source: uuids, text: 'UUIDs copied to the clipboard' });
|
|
|
|
</script>
|
|
|
|
|
2022-04-04 21:46:35 +02:00
|
|
|
<template>
|
2023-05-27 17:36:15 +02:00
|
|
|
<div>
|
|
|
|
<div flex items-center justify-center gap-3>
|
2023-04-13 23:30:33 +02:00
|
|
|
Quantity :
|
|
|
|
<n-input-number v-model:value="count" :min="1" :max="50" placeholder="UUID quantity" />
|
2023-05-27 17:36:15 +02:00
|
|
|
</div>
|
2023-04-13 23:30:33 +02:00
|
|
|
|
2023-06-25 15:00:50 +02:00
|
|
|
<c-input-text
|
2023-04-13 23:30:33 +02:00
|
|
|
style="text-align: center; font-family: monospace"
|
|
|
|
:value="uuids"
|
2023-06-25 15:00:50 +02:00
|
|
|
multiline
|
2023-04-13 23:30:33 +02:00
|
|
|
placeholder="Your uuids"
|
2023-06-25 15:00:50 +02:00
|
|
|
autosize
|
|
|
|
rows="1"
|
2023-04-13 23:30:33 +02:00
|
|
|
readonly
|
2023-06-25 15:00:50 +02:00
|
|
|
raw-text
|
|
|
|
monospace
|
2023-05-27 17:36:15 +02:00
|
|
|
my-3
|
2023-06-25 15:00:50 +02:00
|
|
|
class="uuid-display"
|
2023-04-13 23:30:33 +02:00
|
|
|
/>
|
|
|
|
|
2023-05-27 17:36:15 +02:00
|
|
|
<div flex justify-center gap-3>
|
2023-05-28 23:13:24 +02:00
|
|
|
<c-button autofocus @click="copy">
|
|
|
|
Copy
|
|
|
|
</c-button>
|
|
|
|
<c-button @click="refreshUUIDs">
|
|
|
|
Refresh
|
|
|
|
</c-button>
|
2023-05-27 17:36:15 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-04-04 21:46:35 +02:00
|
|
|
</template>
|
2023-06-25 15:00:50 +02:00
|
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
|
::v-deep(.uuid-display) {
|
|
|
|
textarea {
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|