App.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. export default {
  15. data() {
  16. return {
  17. home: {
  18. visible: true
  19. },
  20. station: {
  21. visible: false
  22. }
  23. }
  24. },
  25. methods: {
  26. goHome() {
  27. this.home.visible = true;
  28. for (let i = 0; i < this.length; i++) {
  29. this[i].visible = false;
  30. }
  31. },
  32. switchView(hide, show) {
  33. this[hide].visible = false;
  34. this[show].visible = true;
  35. }
  36. },
  37. components: { MainHeader, HomeBody, StationBody, MainFooter }
  38. }
  39. </script>
  40. <style lang="sass">
  41. * { box-sizing: border-box; font-family: Roboto, sans-serif; }
  42. html {
  43. width: 100%;
  44. height: 100%;
  45. body {
  46. width: 100%;
  47. height: 100%;
  48. margin: 0;
  49. padding: 0;
  50. }
  51. }
  52. </style>