2024-04-19 14:25:41 +03:00
|
|
|
<template>
|
|
|
|
<h2 class="tool-title">Str numeronym</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="text" :value="toolResult"></MonacoEditor>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import MonacoEditor from "@/components/MonacoEditor.vue";
|
2024-09-29 10:06:13 +03:00
|
|
|
import { unproxy } from "../../utils/unproxy";
|
2024-04-19 14:25:41 +03:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
MonacoEditor
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
toolData: {
|
2024-09-28 15:16:10 +03:00
|
|
|
data: ""
|
2024-04-19 14:25:41 +03:00
|
|
|
},
|
2024-09-28 15:16:10 +03:00
|
|
|
toolResult: ""
|
2024-04-19 14:25:41 +03:00
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
result() {
|
|
|
|
const word = unproxy(this.toolData.data);
|
|
|
|
|
|
|
|
if (word.length <= 3) {
|
|
|
|
this.toolResult = word;
|
2024-09-28 15:16:10 +03:00
|
|
|
return;
|
2024-04-19 14:25:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
const firstLetter = word[0];
|
|
|
|
const lastLetter = word[word.length - 1];
|
|
|
|
const numberOfLetters = word.length - 2;
|
|
|
|
|
|
|
|
this.toolResult = `${firstLetter}${numberOfLetters}${lastLetter}`;
|
2024-09-28 15:16:10 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2024-04-19 14:25:41 +03:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
|
|
</style>
|