toujours afficher les options

front
Gwenael PLANCHON 1 year ago
parent e910f0db60
commit d1d8677b5a

@ -10,11 +10,9 @@ export default {
return { return {
jeuxDispo:[], jeuxDispo:[],
afficherChoixThematiques:false,
thematiquesDispo:[], thematiquesDispo:[],
choixThematiques:[], choixThematiques:[],
afficherChoixDifficultes:false,
difficultesDispo:[], difficultesDispo:[],
choixDifficulte:-1, choixDifficulte:-1,
} }
@ -28,21 +26,11 @@ export default {
return return
utilisateur.login().then(response=>console.log(response)) utilisateur.login().then(response=>console.log(response))
} }
},
watch:{
afficherChoixThematiques(to){
if(to && this.thematiquesDispo.length==0){
Thematiques.getPage(0,999).then(thematiques=>this.thematiquesDispo=thematiques._embedded)
}
},
afficherChoixDifficultes(to){
if(to && this.difficultesDispo.length==0){
Difficultes.getPage(0,999).then(difficultes=>this.difficultesDispo=difficultes._embedded)
}
}
}, },
mounted(){ mounted(){
ListeJeux.get().then(jeux=>this.jeuxDispo=Object.values(jeux)) ListeJeux.get().then(jeux=>this.jeuxDispo=Object.values(jeux))
Difficultes.getPage(0,999).then(difficultes=>this.difficultesDispo=difficultes._embedded)
Thematiques.getPage(0,999).then(thematiques=>this.thematiquesDispo=thematiques._embedded)
} }
} }
@ -56,40 +44,31 @@ export default {
<div class="form-floating"> <div class="form-floating">
</div> </div>
<div class="form-floating"> <div class="form-floating">
<select> <select name="idJeu">
<option v-for="jeu in jeuxDispo" :value="jeu.id"> <option v-for="jeu in jeuxDispo" :value="jeu.id">
{{ jeu.nom }} {{ jeu.nom }}
</option> </option>
</select> </select>
</div> </div>
<div class="checkbox mb-3"> <div class="checkbox mb-3">
<label for="afficherChoixThematiquesCheckbox">Choisir une thématique </label> <label for="thematiquesInput">Thématiques</label>
<input type="checkbox" id="afficherChoixThematiquesCheckbox" v-model="afficherChoixThematiques"/>
<br/> <br/>
<select v-if="afficherChoixThematiques" v-model="choixThematiques" multiple> <select v-model="choixThematiques" id="thematiquesInput" multiple>
<option v-for="thematique in thematiquesDispo" :value="thematique.id"> <option v-for="thematique in thematiquesDispo" :value="thematique.id">
{{ thematique.libelle }} {{ thematique.libelle }}
</option> </option>
</select> </select>
</div> </div>
<div class="checkbox mb-3"> <div class="checkbox mb-3">
<label for="afficherChoixDifficultesCheckbox">Choisir une difficulté </label> <label for="idDifficulteInput">Difficulté</label>
<input type="checkbox" id="afficherChoixDifficultesCheckbox" v-model="afficherChoixDifficultes"/>
<br/> <br/>
<select v-if="afficherChoixDifficultes" v-model="choixDifficulte" name="idDifficulte"> <select v-model="choixDifficulte" id="idDifficulteInput" name="idDifficulte">
<option v-for="difficulte in difficultesDispo" :value="difficulte.id"> <option v-for="difficulte in difficultesDispo" :value="difficulte.id">
{{ difficulte.libelle }} {{ difficulte.libelle }}
</option> </option>
</select> </select>
</div> </div>
<button class="btn btn-lg btn-primary" @click="login">Créer une partie</button>
<div class="checkbox mb-3">
<label>
<label for="rememberMe">Se souvenir de moi</label>
<input type="checkbox" value="1" id="rememberMe" name="rememberMe">
</label>
</div>
<button class="btn btn-lg btn-primary" @click="login">Se connecter</button>
</form> </form>
</template> </template>

Loading…
Cancel
Save