refactor(port-generator): now using computedRefreshable

This commit is contained in:
Corentin Thomasset 2023-03-29 21:05:21 +02:00
parent 165dc93f83
commit f6237376e1
No known key found for this signature in database
GPG key ID: DBD997E935996158

View file

@ -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>