index.vue 792 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <div class="app-container">
  3. <Header :user-type="userType" />
  4. <section class="app-main">
  5. <transition name="fade-transfrom" mode="out-in">
  6. <router-view :key="key"></router-view>
  7. </transition>
  8. </section>
  9. </div>
  10. </template>
  11. <script>
  12. import Header from './components/Header';
  13. export default {
  14. name: 'Layout',
  15. components: {
  16. Header
  17. },
  18. computed: {
  19. key() {
  20. return this.$route.path;
  21. },
  22. userType() {
  23. return this.$store.state.user.user_type === 'teacher' ? '教师' : '学员';
  24. }
  25. }
  26. };
  27. </script>
  28. <style lang="scss" scoped>
  29. .app-container {
  30. height: 100%;
  31. padding-top: $header-h;
  32. .app-main {
  33. height: 100%;
  34. min-height: calc(100vh - #{$header-h});
  35. width: 100%;
  36. position: relative;
  37. }
  38. }
  39. </style>