Files
TLA/resources/js/components/Wordle.vue
T
Belupeti 5d5250287d
Build / Build-image (push) Successful in 1m13s
wordle backend and some frontend changes
2026-08-27 22:33:19 +02:00

66 lines
1.9 KiB
Vue

<template>
<Modal v-model:open="open">
<h1>Wordle for the tired</h1>
<br>
<div class="flex-container-a gap-1.5">
<template v-for="i in max_guesses">
<WordleRow v-if="guesses.length > i" :guess="guesses[i]" :length="correct.length" :correct="correct"/>
<UForm @submit="onsubmit" v-if="guesses.length == i">
<UPinInput v-if="guesses[guesses.length-1].toString().replace(/\,/gi, '') != correct" default class="mb-2" autofocus v-model="guess" color="neutral" :length="correct.length" size="lg" :correct="correct" />
<WordleRow v-else :length="correct.length"/>
<UButton type="submit" style="display: none;">
Submit
</UButton>
</UForm>
<WordleRow v-if="guesses.length < i" :length="correct.length"/>
</template>
</div>
</Modal>
</template>
<script setup lang="ts">
import Modal from './Modal.vue';
import WordleRow from './WordleRow.vue';
</script>
<script lang="ts">
export default {
data() {
return {
max_guesses: 10,
open: true,
guess: '',
guesses: [''],
}
},
props: {
correct: {
type: String,
default: 'nagyonhosszezugyselesz'
},
},
methods: {
onsubmit () {
if (this.guess.length == this.correct.length) {
this.guesses.push(this.guess);
this.guess = '';
}
}
},
}
</script>
<style scoped>
.flex-container-a {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
}
</style>