Skip to content
Snippets Groups Projects
Commit 56ea610d authored by MUNIER Florian's avatar MUNIER Florian
Browse files

[upd] cleaning code

parent c4d1111c
No related branches found
No related tags found
No related merge requests found
<script setup lang="ts">
/*import { RouterLink, RouterView } from 'vue-router'*/
import { ref, computed } from 'vue';
import { ref, computed } from "vue";
import { evaluate } from "mathjs";
import HelloWorld from './components/HelloWorld.vue'
const elements = ref([
"7",
......@@ -36,23 +34,19 @@ const result = computed(() => {
return evaluate(screen_value.value);
} catch (error) {
console.log(error);
return alert("Wrong expression !!! Press clear (C) and try again.");
alert("ERROR : Wrong expression !!!");
return "Press clear (C)";
}
});
function onClick(e: any) {
function onClick(e: any) {
show_result.value = true;
if (!isNaN(e) || ["/", "*", "+", "-"].includes(e)) {
screen_value.value += e;
}
else if (e === "=") {
} else if (e === "=") {
screen_value.value = result.value;
}
else if (e === "C") {
} else if (e === "C") {
screen_value.value = "";
show_result.value = false;
}
......@@ -65,7 +59,7 @@ function onClick(e: any) {
<div v-if="show_result">{{ screen_value }}</div>
<div v-else>{{ 0 }}</div>
</div>
<div>
<div>
<button
v-for="e in elements"
:key="e"
......
<script setup lang="ts">
defineProps<{
msg: string
}>()
</script>
<template>
<div class="greetings">
<h1 class="green">{{ msg }}</h1>
<h3>
You’ve successfully created a project with
<a href="https://vitejs.dev/" target="_blank" rel="noopener">Vite</a> +
<a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>. What's next?
</h3>
</div>
</template>
<style scoped>
h1 {
font-weight: 500;
font-size: 2.6rem;
top: -10px;
}
h3 {
font-size: 1.2rem;
}
.greetings h1,
.greetings h3 {
text-align: center;
}
@media (min-width: 1024px) {
.greetings h1,
.greetings h3 {
text-align: left;
}
}
</style>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment