2022-04-13 13:55:41 +02:00
|
|
|
<template>
|
2022-04-15 23:10:47 +02:00
|
|
|
<n-card>
|
|
|
|
<div class="port">
|
|
|
|
{{ port }}
|
|
|
|
</div>
|
|
|
|
<n-space justify="center">
|
2022-04-22 23:31:40 +02:00
|
|
|
<n-button secondary @click="copy"> Copy </n-button>
|
|
|
|
<n-button secondary @click="refreshPort"> Refresh </n-button>
|
2022-04-15 23:10:47 +02:00
|
|
|
</n-space>
|
|
|
|
</n-card>
|
2022-04-13 13:55:41 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { useCopy } from '@/composable/copy';
|
2022-04-22 23:31:40 +02:00
|
|
|
import { ref } from 'vue';
|
|
|
|
import { generatePort } from './random-port-generator.model';
|
2022-04-13 13:55:41 +02:00
|
|
|
|
2022-04-22 23:31:40 +02:00
|
|
|
const port = ref('');
|
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
|
|
|
|
|
|
|
function refreshPort() {
|
2022-04-22 23:31:40 +02:00
|
|
|
port.value = String(generatePort());
|
2022-04-13 13:55:41 +02:00
|
|
|
}
|
|
|
|
|
2022-04-22 23:31:40 +02:00
|
|
|
refreshPort();
|
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>
|