mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-24 08:46:15 -04:00
refactor(port-generator): now using computedRefreshable
This commit is contained in:
parent
165dc93f83
commit
f6237376e1
1 changed files with 2 additions and 8 deletions
|
@ -11,19 +11,13 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computedRefreshable } from '@/composable/computedRefreshable';
|
||||
import { useCopy } from '@/composable/copy';
|
||||
import { ref } from 'vue';
|
||||
import { generatePort } from './random-port-generator.model';
|
||||
|
||||
const port = ref('');
|
||||
const [port, refreshPort] = computedRefreshable(() => String(generatePort()));
|
||||
|
||||
const { copy } = useCopy({ source: port, text: 'Port copied to the clipboard' });
|
||||
|
||||
function refreshPort() {
|
||||
port.value = String(generatePort());
|
||||
}
|
||||
|
||||
refreshPort();
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue