diff options
Diffstat (limited to 'src/tools/math-evaluator/math-evaluator.vue')
-rw-r--r-- | src/tools/math-evaluator/math-evaluator.vue | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/tools/math-evaluator/math-evaluator.vue b/src/tools/math-evaluator/math-evaluator.vue index a8b359b..0429e6e 100644 --- a/src/tools/math-evaluator/math-evaluator.vue +++ b/src/tools/math-evaluator/math-evaluator.vue @@ -1,3 +1,13 @@ +<script setup lang="ts"> +import { evaluate } from 'mathjs'; +import { computed, ref } from 'vue'; +import { withDefaultOnError } from '@/utils/defaults'; + +const expression = ref(''); + +const result = computed(() => withDefaultOnError(() => evaluate(expression.value) ?? '', '')); +</script> + <template> <div> <n-input @@ -17,13 +27,3 @@ </c-card> </div> </template> - -<script setup lang="ts"> -import { withDefaultOnError } from '@/utils/defaults'; -import { evaluate } from 'mathjs'; -import { computed, ref } from 'vue'; - -const expression = ref(''); - -const result = computed(() => withDefaultOnError(() => evaluate(expression.value) ?? '', '')); -</script> |