aj-report前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
908 B

4 months ago
  1. <template>
  2. <div id="app">
  3. <router-view v-if="isRouterAlive" />
  4. </div>
  5. </template>
  6. <script>
  7. import "@/assets/iconfont/iconfont.css";
  8. import "@/assets/iconfont2/iconfont.css";
  9. import { initDictToLocalstorage } from "@/api/dict-data";
  10. export default {
  11. name: "App",
  12. provide() {
  13. return {
  14. reload: this.reload
  15. };
  16. },
  17. data() {
  18. return {
  19. isRouterAlive: false
  20. };
  21. },
  22. watch: {
  23. $route(to, form) {
  24. if (to.path == "/login") {
  25. this.queryDictName();
  26. }
  27. }
  28. },
  29. computed: {},
  30. created() {
  31. this.queryDictName();
  32. },
  33. methods: {
  34. queryDictName() {
  35. // 初始化数据字典到浏览器本地缓存
  36. initDictToLocalstorage(() => {
  37. this.isRouterAlive = true;
  38. });
  39. },
  40. reload() {
  41. this.isRouterAlive = false;
  42. this.$nextTick(function() {
  43. this.isRouterAlive = true;
  44. });
  45. }
  46. }
  47. };
  48. </script>