diff options
author | 2022-04-12 14:27:52 +0200 | |
---|---|---|
committer | 2022-04-12 14:27:52 +0200 | |
commit | 034c686896d0443ea587cd152535b2227234c011 (patch) | |
tree | a2b62db8213fd8c7012216f4ee6088011e717816 /src/tools/integer-base-converter/integer-base-converter.vue | |
parent | 5cd9997a845f6d5f82d3ae74d3ec12603224517d (diff) | |
download | it-tools-034c686896d0443ea587cd152535b2227234c011.tar.gz it-tools-034c686896d0443ea587cd152535b2227234c011.tar.zst it-tools-034c686896d0443ea587cd152535b2227234c011.zip |
feat(tool): base converter
Diffstat (limited to 'src/tools/integer-base-converter/integer-base-converter.vue')
-rw-r--r-- | src/tools/integer-base-converter/integer-base-converter.vue | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/tools/integer-base-converter/integer-base-converter.vue b/src/tools/integer-base-converter/integer-base-converter.vue new file mode 100644 index 0000000..5508b42 --- /dev/null +++ b/src/tools/integer-base-converter/integer-base-converter.vue @@ -0,0 +1,68 @@ +<template> + <div> + <n-card> + <n-input-group> + <n-input-group-label style="width: 200px;">Input number:</n-input-group-label> + <n-input-number v-model:value="inputNumber" min="0" /> + + <n-input-group-label style="width: 200px;">Input base:</n-input-group-label> + <n-input-number v-model:value="inputBase" max="64" min="2" style="width: 100px;" /> + </n-input-group> + <n-divider></n-divider> + + + + <n-input-group> + <n-input-group-label style="width: 200px;">Binary (2):</n-input-group-label> + <n-input :value="convertBase({ value: String(inputNumber), fromBase: inputBase, toBase: 2 })" + readonly /> + </n-input-group> + + <n-input-group> + <n-input-group-label style="width: 200px;">Octale (8):</n-input-group-label> + <n-input :value="convertBase({ value: String(inputNumber), fromBase: inputBase, toBase: 8 })" + readonly /> + </n-input-group> + + <n-input-group> + <n-input-group-label style="width: 200px;">Decimal (10):</n-input-group-label> + <n-input :value="convertBase({ value: String(inputNumber), fromBase: inputBase, toBase: 10 })" + readonly /> + </n-input-group> + + <n-input-group> + <n-input-group-label style="width: 200px;">Hexadecimal (16):</n-input-group-label> + <n-input :value="convertBase({ value: String(inputNumber), fromBase: inputBase, toBase: 16 })" + readonly /> + </n-input-group> + + <n-input-group> + <n-input-group-label style="width: 200px;">Base64 (64):</n-input-group-label> + <n-input :value="convertBase({ value: String(inputNumber), fromBase: inputBase, toBase: 64 })" + readonly /> + </n-input-group> + <n-input-group> + <n-input-group-label style="width: 90px;">Custom:</n-input-group-label> + <n-input-number style="width: 110px;" v-model:value="outputBase" max="64" min="2" /> + <n-input :value="convertBase({ value: String(inputNumber), fromBase: inputBase, toBase: outputBase })" + readonly /> + </n-input-group> + </n-card> + </div> +</template> + +<script setup lang="ts"> +import { ref } from 'vue' +import { convertBase } from './integer-base-converter.model' + +const inputNumber = ref(42) +const inputBase = ref(10) +const outputBase = ref(42) + +</script> + +<style lang="less" scoped> +.n-input-group:not(:first-child) { + margin-top: 5px; +} +</style>
\ No newline at end of file |