App.vue 786 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <div id="app">
  3. <router-view />
  4. </div>
  5. </template>
  6. <script>
  7. import { updateDocumentTitle } from '@/utils/document-title-util';
  8. export default {
  9. name: 'App',
  10. created () {
  11. console.log(
  12. '我是-----------aps----应用------------------------------------'
  13. );
  14. // 恢复主题
  15. this.$store.dispatch('theme/recoverTheme');
  16. },
  17. methods: {
  18. /* 路由切换更新浏览器标题 */
  19. setDocumentTitle () {
  20. updateDocumentTitle(
  21. this.$route,
  22. (key) => this.$t(key),
  23. this.$store.state.theme.tabs
  24. );
  25. }
  26. },
  27. watch: {
  28. '$i18n.locale' () {
  29. this.setDocumentTitle();
  30. },
  31. $route () {
  32. this.setDocumentTitle();
  33. }
  34. }
  35. };
  36. </script>