random-web-tools/src/views/StrToNATOAlphabet.vue

55 lines
1.4 KiB
Vue
Raw Normal View History

2024-04-19 14:41:49 +03:00
<template>
<h2 class="tool-title">Str to NATO alphabet</h2>
<hr class="mt-5 mb-5">
<div class="input-group">
<label for="data">Data</label>
<input id="data" v-model="toolData.data" v-on:keyup="result" type="text">
</div>
<hr class="mt-5 mb-5">
<div class="input-group">
<label for="result">Result</label>
<MonacoEditor name="result" language="php" :value="toolResult"></MonacoEditor>
</div>
</template>
<script>
2024-09-28 15:16:10 +03:00
import axios from "axios";
import { config } from "../../config";
2024-04-19 14:41:49 +03:00
import MonacoEditor from "@/components/MonacoEditor.vue";
export default {
components: {
MonacoEditor
},
data() {
return {
toolData: {
2024-09-28 15:16:10 +03:00
data: ""
2024-04-19 14:41:49 +03:00
},
2024-09-28 15:16:10 +03:00
toolResult: ""
2024-04-19 14:41:49 +03:00
};
},
methods: {
result() {
const natoAlphabet = {
2024-09-28 15:16:10 +03:00
"A": "Alpha", "B": "Bravo", "C": "Charlie", "D": "Delta",
"E": "Echo", "F": "Foxtrot", "G": "Golf", "H": "Hotel",
"I": "India", "J": "Juliett", "K": "Kilo", "L": "Lima",
"M": "Mike", "N": "November", "O": "Oscar", "P": "Papa",
"Q": "Quebec", "R": "Romeo", "S": "Sierra", "T": "Tango",
"U": "Uniform", "V": "Victor", "W": "Whiskey", "X": "X-ray",
"Y": "Yankee", "Z": "Zulu"
2024-04-19 14:41:49 +03:00
};
2024-09-28 15:16:10 +03:00
this.toolResult = this.toolData.data.toUpperCase().split("").map(char => natoAlphabet[char] || char).join(" ");
2024-04-19 14:41:49 +03:00
}
}
2024-09-28 15:16:10 +03:00
};
2024-04-19 14:41:49 +03:00
</script>
<style lang="scss">
</style>