|
|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
import { ref, watch, reactive } from 'vue' |
|
|
|
|
|
|
|
|
|
const url = 'http://localhost:3000' |
|
|
|
|
//const url = 'https://converterApi.voiedesombres.com' |
|
|
|
|
|
|
|
|
|
const result = ref(null) |
|
|
|
|
const number_to_convert = ref(null) |
|
|
|
|
@ -47,6 +48,10 @@ function preventKey(e) {
|
|
|
|
|
if (e.which != 8 && e.which != 0 && e.which < 48 || e.which > 57) e.preventDefault() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function submitConvert(e) { |
|
|
|
|
if (e.which === 13) convertNumber() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
watch(number_to_convert, () => { |
|
|
|
|
reset_form() |
|
|
|
|
}) |
|
|
|
|
@ -58,7 +63,7 @@ watch(number_to_convert, () => {
|
|
|
|
|
<h1 class="self-center font-semibold dark:text-white">Write an arabic number, click on convert, and you will have the result as roman number.</h1> |
|
|
|
|
<div class="flex items-center mt-10"> |
|
|
|
|
<div class="relative z-0 w-4/12 group"> |
|
|
|
|
<input type="number" name="number_to_convert" id="number_to_convert" @keypress="preventKey" v-model="number_to_convert" class="block py-2.5 px-0 w-full text-sm text-gray-900 bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-blue-500 focus:outline-none focus:ring-0 focus:border-blue-600 peer" placeholder=" " required /> |
|
|
|
|
<input type="number" name="number_to_convert" id="number_to_convert" @keypress="preventKey" @keyup="submitConvert" v-model="number_to_convert" class="block py-2.5 px-0 w-full text-sm text-gray-900 bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-blue-500 focus:outline-none focus:ring-0 focus:border-blue-600 peer" placeholder=" " required /> |
|
|
|
|
<label for="number_to_convert" class="peer-focus:font-medium absolute text-sm text-gray-500 dark:text-gray-400 duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-blue-600 peer-focus:dark:text-blue-500 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6">Number to convert</label> |
|
|
|
|
</div> |
|
|
|
|
<div class="w-2/12 ml-3"> |
|
|
|
|
|