ソースを参照

转件清空keep-alive

songxy 1 年間 前
コミット
b28da18567

+ 1 - 1
client_h5/.env.dev

@@ -6,4 +6,4 @@ VITE_BASE_URL='http://10.10.10.7:18080'
 # File上传路径
 VITE_FILE_BASE_URI='/admin-api/infra/file'
 
-VITE_AUTHORIZATION='ee616fbb477942fc975bc7a46e00a9bc'
+VITE_AUTHORIZATION='4508abd4478f48a8bb88073bca4cae14'

+ 6 - 0
client_h5/src/App.vue

@@ -1,4 +1,6 @@
 <script setup lang="ts">
+import PubsubService from "@/utils/PubsubService";
+
 type RouteName = string[]
 /***
  * 需要缓存滚动条的配置
@@ -19,6 +21,10 @@ window.addEventListener("scroll", () => {
     scrollTopMap.value[routeName] = top;
   }
 })
+PubsubService.subscribe('clear_keep_alive', () => {
+    keepAliveIncludes.value = []
+    scrollTopMap.value = {}
+})
 watch(
   () => router.currentRoute.value,
   (newValue: any) => {

+ 2 - 0
client_h5/src/components/flowForm.vue

@@ -83,6 +83,7 @@
 import { showNotify } from 'vant';
 import { closePage } from 'dingtalk-jsapi';
 import { getSimpleUserMap } from '@/service/user'
+import PubsubService from "@/utils/PubsubService";
 import { formatDate, jsonToFormData } from "@/utils/common";
 import { FlowDTO, getNextActivity } from "@/service/flow";
 import { getTemplateOpinionListByFlowInstanceId, getOpinionListByFlowInstanceId } from '@/service/flow';
@@ -207,6 +208,7 @@ const submitHandle = async (): Promise<any> => {
           position: 'top',
           onClose() {
             isSubmitDisabled.value = false;
+            PubsubService.publish('clear_keep_alive')
             if (_top == '1') {
               closePage({})
             } else {

+ 0 - 1
client_h5/src/router/index.ts

@@ -12,7 +12,6 @@ const router = createRouter({
   routes: routes as RouteRecordRaw[],
   scrollBehavior: () => ({ left: 0, top: 0 })
 })
-
 // 路由加载前
 router.beforeEach((to, from, next) => {
   getUserInfoPromise(true).then((isLogin) => {

+ 1 - 1
client_h5/src/utils/PubsubService.ts

@@ -7,7 +7,7 @@ class PubsubService {
   private topics: Record<string, ((params?: any) => void)[]> = {}
 
   // 发布事件
-  publish(topic: string, data: any) {
+  publish(topic: string, data?: any) {
     if (!this.topics[topic]) return
     this.topics[topic].forEach((fn) => fn(data))
   }