1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<template>
<div class="home">
<page-title pagetitle="Riichi Mahjong"/>
<form class="home-form" action="#" @submit.prevent="onSubmit">
<button-text id="login" width="615px" height="130px" text="Se Connecter"/>
<button-text id="register" width="615px" height="130px" text="S'Enregistrer"/>
</form>
</div>
</template>
<script>
import PageTitle from '@/components/PageTitle.vue'
import ButtonText from '../components/ButtonText.vue'
export default {
name: 'Home',
components: {
PageTitle,
ButtonText
},
beforeCreate () {
if (localStorage.getItem('user') != null) {
this.$router.push('/lobby');
}
},
methods: {
onSubmit: function(){
if (event.submitter.id=='login') {
this.$router.push('login');
}
if (event.submitter.id=='register') {
this.$router.push('register');
}
}
}
}
</script>
<style>
.home{
position: relative;
top: 200px;
display: flex;
flex-direction: column;
}
.home *{
margin-left:auto;
margin-right:auto;
}
.home-form{
display: flex;
flex-direction: column;
}
</style>