it-tools/src/tools/random-port-generator/random-port-generator.vue

31 lines
759 B
Vue
Raw Normal View History

2022-04-13 13:55:41 +02:00
<template>
<c-card>
2022-04-15 23:10:47 +02:00
<div class="port">
{{ port }}
</div>
2023-05-27 17:36:15 +02:00
<div flex justify-center gap-3>
<c-button @click="copy"> Copy </c-button>
<c-button @click="refreshPort"> Refresh </c-button>
2023-05-27 17:36:15 +02:00
</div>
</c-card>
2022-04-13 13:55:41 +02:00
</template>
<script setup lang="ts">
import { computedRefreshable } from '@/composable/computedRefreshable';
2022-04-13 13:55:41 +02:00
import { useCopy } from '@/composable/copy';
2022-04-22 23:31:40 +02:00
import { generatePort } from './random-port-generator.model';
2022-04-13 13:55:41 +02:00
const [port, refreshPort] = computedRefreshable(() => String(generatePort()));
2022-04-13 13:55:41 +02:00
2022-04-22 23:31:40 +02:00
const { copy } = useCopy({ source: port, text: 'Port copied to the clipboard' });
2022-04-13 13:55:41 +02:00
</script>
2022-04-13 14:08:26 +02:00
<style lang="less" scoped>
.port {
2022-04-22 23:31:40 +02:00
text-align: center;
font-size: 26px;
font-weight: 400;
margin: 10px 0 25px;
2022-04-13 14:08:26 +02:00
}
2022-04-22 23:31:40 +02:00
</style>