This commit is contained in:
@@ -25,17 +25,21 @@
|
||||
|
||||
methods: {
|
||||
onSubmit() {
|
||||
axios
|
||||
.post("/api/check_tla/en", {
|
||||
guess: this.guess,
|
||||
})
|
||||
.then((response) => {
|
||||
console.log(response.data);
|
||||
this.guesses = response.data.guesses;
|
||||
})
|
||||
|
||||
if (this.words.length == 3) {
|
||||
console.log(this.words)
|
||||
axios
|
||||
.post("/api/check_tla/en", {
|
||||
guess: this.words,
|
||||
})
|
||||
.then((response) => {
|
||||
console.log(response.data);
|
||||
this.guesses = response.data.guesses;
|
||||
})
|
||||
}
|
||||
},
|
||||
onkeyup() {
|
||||
this.words = this.guess.trim().split(" ");
|
||||
this.words = this.guess.trim().split(/\W+/);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,13 +68,13 @@
|
||||
|
||||
<div class="flex-container">
|
||||
<template v-for="word in words">
|
||||
<GuessWord :correctness="-1">
|
||||
<GuessWord :correctness="words.length == 3 ? -1 : (words.length > 3 ? -2 : -3)">
|
||||
{{ word }}
|
||||
</GuessWord>
|
||||
</template>
|
||||
</div>
|
||||
<form @submit="onSubmit" onsubmit="return false">
|
||||
<input type="text" @keyup="onkeyup" v-model="guess">
|
||||
<input type="text" @keyup="onkeyup()" v-model="guess">
|
||||
</form>
|
||||
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user