App.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!--
  2. * @Author: qfkong kongqf@yusys.com.cn
  3. * @Date: 2024-03-26 15:54:56
  4. * @LastEditors: qfkong kongqf@yusys.com.cn
  5. * @LastEditTime: 2024-04-13 23:19:43
  6. * @FilePath: \oca-web\src\App.vue
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. -->
  9. <template>
  10. <div id="app" class="yu-frame-root">
  11. <transition>
  12. <router-view />
  13. </transition>
  14. <chatDragIcon v-if="false"></chatDragIcon>
  15. <chatDialog :keepCenter="true">
  16. <chat />
  17. </chatDialog>
  18. </div>
  19. </template>
  20. <script>
  21. import chatDragIcon from '@xdjf/idd/components/XiaoyuChat/components/chatDragIcon.vue';
  22. import chatDialog from '@xdjf/idd/components/XiaoyuChat/components/chatDialog.vue';
  23. import chat from '@xdjf/idd/components/XiaoyuChat/components/chat.vue';
  24. export default {
  25. name: 'App',
  26. components: {
  27. chatDragIcon,
  28. chatDialog,
  29. chat,
  30. },
  31. computed: {
  32. shouldShow() {
  33. const { path } = this.$route;
  34. const excludedPaths = ['/login', '/401', '/404'];
  35. if (excludedPaths.includes(path)) {
  36. return false;
  37. }
  38. const includePatterns = [/^\/@xdjf\/intelligent-due-diligence\/views(\/.*)?$/, /^.*$/];
  39. return includePatterns.some((pattern) => pattern.test(path));
  40. },
  41. },
  42. mounted() {
  43. this.hotUpdateVite(); // 用于在keepalive场景下,vite 更新代码页面没有重新加载的问题
  44. },
  45. methods: {
  46. hotUpdateVite() {
  47. // 判断是否开启热更新
  48. if (import.meta.hot) {
  49. // 监听vite更新
  50. import.meta.hot.on('vite:beforeUpdate', (updatesObj) => {
  51. updatesObj.updates.forEach((element) => {
  52. this.$route.matched.forEach((matched) => {
  53. // 目前路由的文件路径
  54. const filePath = matched.components.default.__file;
  55. // vite 热更新的文件路径
  56. const upPath = element.path.split('?')[0];
  57. // 判断是否是当前页面
  58. if (filePath.indexOf(upPath) !== -1) location.reload(); // 强制页面重新加载
  59. });
  60. });
  61. });
  62. }
  63. },
  64. },
  65. };
  66. </script>