App.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. },
  33. components: { MainHeader, HomeBody, StationBody, MainFooter },
  34. events: {
  35. 'switchView': function(hide, show) {
  36. this[hide].visible = false;
  37. this[show].visible = true;
  38. }
  39. }
  40. }
  41. </script>
  42. <style lang="sass">
  43. * { box-sizing: border-box; font-family: Roboto, sans-serif; }
  44. html {
  45. width: 100%;
  46. height: 100%;
  47. body {
  48. width: 100%;
  49. height: 100%;
  50. margin: 0;
  51. padding: 0;
  52. }
  53. }
  54. </style>