2022-04-13 13:55:41 +02:00
|
|
|
<template>
|
2023-04-20 20:49:28 +02:00
|
|
|
<c-card>
|
2022-04-15 23:10:47 +02:00
|
|
|
<div class="port">
|
|
|
|
{{ port }}
|
|
|
|
</div>
|
|
|
|
<n-space justify="center">
|
2023-04-19 21:38:59 +02:00
|
|
|
<c-button @click="copy"> Copy </c-button>
|
|
|
|
<c-button @click="refreshPort"> Refresh </c-button>
|
2022-04-15 23:10:47 +02:00
|
|
|
</n-space>
|
2023-04-20 20:49:28 +02:00
|
|
|
</c-card>
|
2022-04-13 13:55:41 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2023-03-29 21:05:21 +02:00
|
|
|
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
|
|
|
|
2023-03-29 21:05:21 +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>
|