update howtoplay, add some localstorage functionality
Build / Build-image (push) Successful in 1m30s
Build / Build-image (push) Successful in 1m30s
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
<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">
|
||||
@@ -20,6 +19,10 @@
|
||||
<WordleRow v-if="guesses.length < i" :length="correct.length"/>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<UButton @click="onsubmit" class="m-1.5">
|
||||
Submit
|
||||
</UButton>
|
||||
</Modal>
|
||||
|
||||
</template>
|
||||
@@ -50,13 +53,7 @@
|
||||
|
||||
},
|
||||
mounted() {
|
||||
if (localStorage.getItem('guesses')) {
|
||||
try {
|
||||
this.guesses = JSON.parse(localStorage.getItem('guesses'));
|
||||
} catch(e) {
|
||||
localStorage.removeItem('guesses');
|
||||
}
|
||||
}
|
||||
this.guesses = JSON.parse(localStorage.getItem('guesses-' + this.index) || '[""]');
|
||||
},
|
||||
methods: {
|
||||
onsubmit () {
|
||||
@@ -64,7 +61,7 @@
|
||||
this.guesses.push(this.guess);
|
||||
this.guess = '';
|
||||
|
||||
localStorage.guesses[this.index] = this.guesses;
|
||||
localStorage.setItem('guesses-' + this.index, JSON.stringify(this.guesses));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user