AppMenu.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <b-container>
  3. <b-row class="justify-content-center mb-4 pt-3">
  4. <b-col lg="8" md="7" sm="8" xl="8">
  5. <a href="#">
  6. <b-img class="titleImg" :src="require('../assets/Title.png')"></b-img>
  7. </a>
  8. </b-col>
  9. </b-row>
  10. <b-row class="justify-content-center mt-3 mb-5">
  11. <b-col lg="8" md="7" sm="8" xl="8">
  12. <div class="backgroundMenu">
  13. <keep-alive include="menu-login">
  14. <component
  15. :is="menuPage"
  16. @enter-online="enterOnline"
  17. @enter-game-creation="enterGameCreation"
  18. @enter-local="enterLocal"
  19. @back="menuPage = previousPage.pop()"
  20. @home="
  21. menuPage = 'menu-login';
  22. previousPage = [];
  23. "
  24. :username="username"
  25. v-on="$listeners"
  26. ></component>
  27. </keep-alive>
  28. </div>
  29. </b-col>
  30. </b-row>
  31. </b-container>
  32. </template>
  33. <script>
  34. import MenuLogin from './login/MenuLogin';
  35. import MenuOnlineRoom from './online-room/MenuOnlineRoom';
  36. import MenuGameCreation from './game-creation/MenuGameCreation';
  37. export default {
  38. data() {
  39. return {
  40. previousPage: [],
  41. menuPage: 'menu-login',
  42. username: ''
  43. };
  44. },
  45. components: {
  46. MenuLogin,
  47. MenuOnlineRoom,
  48. MenuGameCreation
  49. },
  50. methods: {
  51. enterLocal() {
  52. alert('Not implemented yet, give us time ! :)');
  53. },
  54. enterOnline(username) {
  55. this.previousPage.push(this.menuPage);
  56. console.log('enter online with username : ' + username);
  57. this.username = username;
  58. this.menuPage = 'menu-online-room';
  59. },
  60. enterGameCreation() {
  61. this.previousPage.push(this.menuPage);
  62. this.menuPage = 'menu-game-creation';
  63. }
  64. }
  65. };
  66. </script>
  67. <style scoped>
  68. .titleImg {
  69. max-width: 100%;
  70. }
  71. .backgroundMenu {
  72. /* The image used */
  73. background-image: url('../assets/parchemin.png');
  74. /* Full height */
  75. height: 100%;
  76. /* Center and scale the image nicely */
  77. background-position: center;
  78. background-repeat: no-repeat;
  79. background-size: cover;
  80. }
  81. </style>