App.vue 1.0 KB

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