mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 06:55:06 -04:00
refactor(uuid-generator): prevent NaN in quantity
This commit is contained in:
parent
7d7cc99866
commit
6fb4994603
1 changed files with 25 additions and 29 deletions
|
@ -1,11 +1,10 @@
|
|||
<template>
|
||||
<div>
|
||||
<n-card>
|
||||
<n-space vertical :size="20">
|
||||
<n-space align="center" justify="center">
|
||||
Quantity :
|
||||
<n-input-number v-model:value="count" :min="1" :max="50" />
|
||||
<n-input-number v-model:value="count" :min="1" :max="50" placeholder="UUID quantity" />
|
||||
</n-space>
|
||||
<br />
|
||||
|
||||
<n-input
|
||||
style="text-align: center; font-family: monospace"
|
||||
:value="uuids"
|
||||
|
@ -18,23 +17,20 @@
|
|||
autocapitalize="off"
|
||||
spellcheck="false"
|
||||
/>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<n-space justify="center">
|
||||
<n-button secondary autofocus @click="copy"> Copy </n-button>
|
||||
<n-button secondary @click="refreshUUIDs"> Refresh </n-button>
|
||||
</n-space>
|
||||
</n-card>
|
||||
</div>
|
||||
</n-space>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useCopy } from '@/composable/copy';
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
import { useQueryParam } from '@/composable/queryParams';
|
||||
import { computedRefreshable } from '@/composable/computedRefreshable';
|
||||
|
||||
const count = useQueryParam({ defaultValue: 1, name: 'count' });
|
||||
const count = useStorage('uuid-generator:quantity', 1);
|
||||
|
||||
const [uuids, refreshUUIDs] = computedRefreshable(() =>
|
||||
Array.from({ length: count.value }, () => generateUUID()).join('\n'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue