Эх сурвалжийг харах

fix(vendor): team 页面 onLoad/onShow 首次加载守卫,消除审计 LIFECYCLE_DOUBLE 报错

liaoxg 6 өдөр өмнө
parent
commit
0ac904c121

+ 11 - 5
cfc-frontend/pages/vendor/team-customers/team-customers.vue

@@ -109,14 +109,20 @@ export default {
     this.systemId = options.systemId || ''
     this.parentId = options.parentId || ''
     this.loadCustomers()
+    this._onLoadFired = true
   },
 
   onShow() {
-    // 切Tab返回时刷新
-    this.page = 1
-    this.customers = []
-    this.hasMore = true
-    this.loadCustomers()
+    if (this._onLoadFired) {
+      // 首次进入:onLoad 已加载,跳过避免双发
+      this._onLoadFired = false
+    } else {
+      // 切Tab返回时刷新
+      this.page = 1
+      this.customers = []
+      this.hasMore = true
+      this.loadCustomers()
+    }
   },
 
   methods: {

+ 7 - 1
cfc-frontend/pages/vendor/team-system/team-system.vue

@@ -154,10 +154,16 @@ export default {
 
   onLoad() {
     this.loadData()
+    this._onLoadFired = true
   },
 
   onShow() {
-    this.loadData()
+    if (this._onLoadFired) {
+      // 首次进入:onLoad 已加载,跳过避免双发
+      this._onLoadFired = false
+    } else {
+      this.loadData()
+    }
   },
 
   methods: {