App.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <div class="app">
  3. <main-header></main-header>
  4. <home-body v-if="home.visible"></home-body>
  5. <station-body v-if="station.visible"></station-body>
  6. <main-footer></main-footer>
  7. </div>
  8. </template>
  9. <script>
  10. import MainHeader from './MainHeader.vue'
  11. import HomeBody from './HomeBody.vue'
  12. import StationBody from './StationBody.vue'
  13. import MainFooter from './MainFooter.vue'
  14. let socket = io();
  15. export default {
  16. data() {
  17. return {
  18. home: {
  19. visible: true
  20. },
  21. station: {
  22. visible: false
  23. },
  24. register: {
  25. email: "",
  26. username: "",
  27. password: ""
  28. }
  29. }
  30. },
  31. methods: {
  32. goHome() {
  33. this.home.visible = true;
  34. for (let i = 0; i < this.length; i++) {
  35. this[i].visible = false;
  36. }
  37. }
  38. },
  39. components: { MainHeader, HomeBody, StationBody, MainFooter },
  40. events: {
  41. 'switchView': function(hide, show) {
  42. this[hide].visible = false;
  43. this[show].visible = true;
  44. },
  45. 'register': function() {
  46. console.log('registered');
  47. socket.emit('/users/register', {
  48. email: this.register.email,
  49. username: this.register.username,
  50. password: this.register.password,
  51. recaptcha: grecaptcha.getResponse()
  52. });
  53. }
  54. }
  55. }
  56. </script>
  57. <style lang="sass">
  58. * { box-sizing: border-box; font-family: Roboto, sans-serif; }
  59. html {
  60. width: 100%;
  61. height: 100%;
  62. color: rgba(0, 0, 0, 0.87);
  63. body {
  64. width: 100%;
  65. height: 100%;
  66. margin: 0;
  67. padding: 0;
  68. }
  69. }
  70. @media only screen and (min-width: 1200px) {
  71. html {
  72. font-size: 15px;
  73. }
  74. }
  75. @media only screen and (min-width: 992px) {
  76. html {
  77. font-size: 14.5px;
  78. }
  79. }
  80. @media only screen and (min-width: 0) {
  81. html {
  82. font-size: 14px;
  83. }
  84. }
  85. </style>