App.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <div id="app" class="flex flex-center">
  3. <router-view v-slot="{ Component, route }">
  4. <keep-alive :include="keepAlive.list">
  5. <component :is="Component" :key="route.fullPath" />
  6. </keep-alive>
  7. </router-view>
  8. </div>
  9. </template>
  10. <script>
  11. // This starter template is using Vue 3 <script setup> SFCs
  12. // Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
  13. import keepAliveStore from '@/store/keepAlive.js'
  14. export default {
  15. setup() {
  16. const keepAlive = keepAliveStore()
  17. return { keepAlive }
  18. },
  19. data() {
  20. return {
  21. data: '',
  22. type: '33'
  23. }
  24. },
  25. created() {
  26. console.info(
  27. '%c由%c梧桐研究院%c提供技术支持,版本号: v1.0.0',
  28. 'font-size: 14px; margin-bottom: 2px; padding: 6px 8px; color: #fff; background: #707070;',
  29. 'font-size: 14px; margin-bottom: 2px; padding: 6px 8px; color: #fff; background: orange;',
  30. 'font-size: 14px; margin-bottom: 2px; padding: 6px 8px; color: #fff; background: #707070;'
  31. )
  32. },
  33. mounted() {
  34. window.addEventListener('scroll', this.menu)
  35. },
  36. methods: {
  37. menu() {
  38. const scroll =
  39. document.documentElement.scrollTop || document.body.scrollTop
  40. this.$bus.emit('scorll', scroll)
  41. }
  42. }
  43. }
  44. </script>
  45. <style scoped>
  46. #app {
  47. background-color: #f6f7f8;
  48. }
  49. </style>