Commit 18fef28e authored by quentin.vrel's avatar quentin.vrel

handling the different routes

parent 2fae6713
<template> <template>
<button class="text-button" :style="this.style" v-on:click="this.emit"> <button :id="this.id" class="text-button" :style="this.style">
{{text}} {{text}}
</button> </button>
</template> </template>
...@@ -29,7 +29,9 @@ export default { ...@@ -29,7 +29,9 @@ export default {
text: { type: String, default: ''}, text: { type: String, default: ''},
width: { type: [String], default: "750px" }, width: { type: [String], default: "750px" },
height: { type: [String], default: "130px" }, height: { type: [String], default: "130px" },
click: {type: String, default: ''} click: {type: String, default: ''},
id: {type: String, default: ''},
}, },
computed: { computed: {
style() { style() {
...@@ -38,10 +40,6 @@ export default { ...@@ -38,10 +40,6 @@ export default {
maxWidth: this.width maxWidth: this.width
} }
return style; return style;
},
emit () {
const emit = "$emit('"+this.click+"')";
return emit
} }
} }
} }
......
<template> <template>
<div class="home"> <div class="home">
<page-title pagetitle="Riichi Mahjong"/> <page-title pagetitle="Riichi Mahjong"/>
<form action="#" @submit.prevent="login"> <form class="home-form" action="#" @submit.prevent="onSubmit">
<button-text width="615px" height="130px" text="Se Connecter"/> <button-text id="login" width="615px" height="130px" text="Se Connecter"/>
</form> <button-text id="register" width="615px" height="130px" text="S'Enregistrer"/>
<form action="#" @submit.prevent="register">
<button-text width="615px" height="130px" text="S'Enregistrer"/>
</form> </form>
</div> </div>
</template> </template>
...@@ -21,13 +19,15 @@ export default { ...@@ -21,13 +19,15 @@ export default {
ButtonText ButtonText
}, },
methods: { methods: {
login: function(){ onSubmit: function(){
if (event.submitter.id=='login') {
this.$router.push('login'); this.$router.push('login');
}, }
register: function(){ if (event.submitter.id=='register') {
this.$router.push('register'); this.$router.push('register');
} }
} }
}
} }
</script> </script>
...@@ -43,4 +43,9 @@ export default { ...@@ -43,4 +43,9 @@ export default {
margin-left:auto; margin-left:auto;
margin-right:auto; margin-right:auto;
} }
.home-form{
display: flex;
flex-direction: column;
}
</style> </style>
\ No newline at end of file
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
</div> </div>
<svg-button svg="/icons/back.svg"/> <svg-button id="back" svg="/icons/back.svg"/>
<svg-button svg="/icons/validate.svg"/> <svg-button id="validate" svg="/icons/validate.svg"/>
</form> </form>
</div> </div>
</template> </template>
...@@ -31,10 +31,15 @@ export default { ...@@ -31,10 +31,15 @@ export default {
CheckboxInput CheckboxInput
}, },
methods: { methods: {
onSubmit: function(){ onSubmit: function(event){
if (event.submitter.id=='back') {
this.$router.push('/');
}
if (event.submitter.id=='validate') {
this.$router.push('lobby'); this.$router.push('lobby');
} }
} }
}
} }
</script> </script>
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
</div> </div>
<svg-button svg="/icons/back.svg"/> <svg-button id="back" svg="/icons/back.svg"/>
<svg-button svg="/icons/validate.svg"/> <svg-button id="validate" svg="/icons/validate.svg"/>
</form> </form>
</div> </div>
</template> </template>
...@@ -56,9 +56,14 @@ export default { ...@@ -56,9 +56,14 @@ export default {
if (this.showBackError) { if (this.showBackError) {
return; return;
} }
if (event.submitter.id=='back') {
this.$router.push('/');
}
if (event.submitter.id=='validate') {
this.$router.push('lobby'); this.$router.push('lobby');
} }
} }
}
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment