App.vue 992 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <div id="app">
  3. <nav-header></nav-header>
  4. <router-view></router-view>
  5. </div>
  6. </template>
  7. <script>
  8. import {NavHeader} from '@/components/common'
  9. export default {
  10. name: 'app',
  11. components: {
  12. NavHeader
  13. },
  14. created () {
  15. // 首次获取未处理申诉的数量
  16. this.$store.dispatch('countUnHandleAppeals')
  17. // 建立定时任务不断获取未处理申诉的数量
  18. window.appealsCount = setInterval(() => {
  19. this.$store.dispatch('countUnHandleAppeals')
  20. }, 3000)
  21. },
  22. beforeRouteLeave () {
  23. console.log('清除定时器')
  24. clearInterval(window.appealsCount)
  25. }
  26. }
  27. </script>
  28. <!-- Global CSS for all vue components -->
  29. <style>
  30. html, body {
  31. /* TODO 1920 * 880 */
  32. width: 100%;
  33. height: 100%;
  34. font-family: "Microsoft YaHei", "Microsoft YaHei UI", sans-serif;
  35. }
  36. a:hover, a:visited, a:focus {
  37. text-decoration: none;
  38. }
  39. </style>
  40. <!-- scoped CSS -->
  41. <style scoped>
  42. </style>