index.vue 890 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <section id="proginn-container">
  3. <proginn-header v-if="isPC != -1 && isPC"/>
  4. <router-view v-if="isPC != -1" id="main"/>
  5. <proginn-footer v-if="isPC != -1 && isPC"/>
  6. </section>
  7. </template>
  8. <script>
  9. import ProginnHeader from '@/components/header'
  10. import ProginnFooter from '@/components/footer'
  11. import { mapState, mapMutations } from 'vuex'
  12. export default {
  13. components: {
  14. ProginnHeader,
  15. ProginnFooter
  16. },
  17. computed: {
  18. ...mapState(['isPC']),
  19. },
  20. mounted() {
  21. this.checkInnerWidth()
  22. window.addEventListener('resize', this.checkInnerWidth)
  23. },
  24. methods: {
  25. ...mapMutations(['updateIsPC']),
  26. checkInnerWidth() {
  27. this.updateIsPC({
  28. isPC: window.innerWidth > 960,
  29. })
  30. }
  31. }
  32. }
  33. </script>
  34. <style>
  35. #proginn-container {
  36. display: flex;
  37. flex-direction: column;
  38. align-items: center;
  39. }
  40. #main {
  41. flex: 1;
  42. }
  43. </style>