router-view.vue 868 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <router-view v-slot="{ Component }">
  3. <!-- <transition>-->
  4. <keep-alive>
  5. <component :is="Component" />
  6. </keep-alive>
  7. <!-- </transition>-->
  8. </router-view>
  9. </template>
  10. <script lang="ts">
  11. import {
  12. defineComponent,
  13. computed,
  14. onMounted,
  15. ref,
  16. reactive,
  17. watch,
  18. getCurrentInstance,
  19. ComponentInternalInstance,
  20. toRefs,
  21. nextTick
  22. } from 'vue'
  23. import {useStore} from 'vuex'
  24. import {useRouter, useRoute} from 'vue-router'
  25. export default defineComponent({
  26. name: '',
  27. components: {},
  28. setup() {
  29. const store = useStore();
  30. const router = useRouter();
  31. const route = useRoute();
  32. const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
  33. const state = reactive({})
  34. return {
  35. ...toRefs(state)
  36. }
  37. },
  38. })
  39. </script>
  40. <style scoped lang="scss">
  41. </style>