index.vue 630 B

123456789101112131415161718192021222324
  1. <!-- router-view 结合 keep-alive 组件 -->
  2. <template>
  3. <transition :name="transitionName" mode="out-in" appear>
  4. <keep-alive :include="include">
  5. <router-view />
  6. </keep-alive>
  7. </transition>
  8. </template>
  9. <script>
  10. export default {
  11. name: 'RouterLayout',
  12. computed: {
  13. include() {
  14. console.log('this.$store.getters-----------------------');
  15. console.log(this.$store.getters['theme/keepAliveInclude']);
  16. return this.$store.getters['theme/keepAliveInclude'] ?? [];
  17. },
  18. transitionName() {
  19. return this.$store.state.theme.transitionName;
  20. }
  21. }
  22. };
  23. </script>