From 91f7d372fa318e859efd20d71eafbd34274902c4 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 20 一月 2026 17:29:43 +0800
Subject: [PATCH] 2026.1.20

---
 component/switchtab/switchtab.js |   63 +++++++++++++++++++------------
 1 files changed, 38 insertions(+), 25 deletions(-)

diff --git a/component/switchtab/switchtab.js b/component/switchtab/switchtab.js
index 74c8aa2..a3b3469 100644
--- a/component/switchtab/switchtab.js
+++ b/component/switchtab/switchtab.js
@@ -8,13 +8,23 @@
    * 缁勪欢鐨勫睘鎬у垪琛�
    */
   properties: {
+    extClass: {
+      type: String,
+      value: ''
+    },
+    extClassOn: {
+      type: String,
+      value: ''
+    },
     tabList: {
       type: Array,
       value: []
     },
-    pageList: {
-      type: Array,
-      value: []
+    //閫氱煡缁勪欢鍒锋柊楂樺害
+    refresh: {
+      type: Boolean,
+      value: false,
+      observer: 'refreshHeight'
     },
   },
 
@@ -27,34 +37,39 @@
     // pageheight: '600px',
   },
 
-  observers: {
-    'pageList': function() {
-      this.tabsHeight('.page0');
-    }
+  pageLifetimes: {
+    // 缁勪欢鎵�鍦ㄩ〉闈㈢殑鐢熷懡鍛ㄦ湡鍑芥暟
+    show: function () {
+      // this.refreshHeight(true)
+
+    },
+    hide: function () { },
+    resize: function () {
+    },
   },
 
   /**
    * 缁勪欢鐨勬柟娉曞垪琛�
    */
   methods: {
+    refreshHeight: function(e) {
+      // console.log(`refreshHeight: ${e}`);
+      if (e) {
+        setTimeout(() => {
+          const p = `.page${this.data.currentTab}`
+          // console.log(p);
+          this.tabsHeight(p);
+        }, 50);
+      }
+    },
     //璁$畻swiper楂樺害鏂规硶锛堝湪鍒囨崲鐨勬椂鍊欒皟鐢級
     tabsHeight(element) {
       let that = this;
-      let query = this.createSelectorQuery(); //蹇呴』瑕佸厛鍒涘缓涓�涓煡璇�
+      let query = this.createSelectorQuery().in(this); //蹇呴』瑕佸厛鍒涘缓涓�涓煡璇�
       query.select(element).boundingClientRect(function (rect) {
-        if (that.data.pageheight) {
-          let pageheight = that.data.pageheight.split('px')[0]
-          pageheight = parseInt(pageheight)
-          if (rect.height > pageheight) {
-            that.setData({
-              pageheight: rect.height + 'px'
-            });
-          }
-        } else {
-          that.setData({
-            pageheight: rect.height + 'px'
-          });
-        }
+        that.setData({
+          pageheight: rect.height + 'px'
+        });
       }).exec();
     },
     swichNav: function (e) {
@@ -64,18 +79,16 @@
       } else {
         that.setData({
           currentTab: e.target.dataset.current,
-          navScrollLeft: e.target.dataset.current >= 3 ? ((e.target.dataset.current) * 60) : 0 //鍒ゆ柇褰撳墠閫変腑鐨勪釜鏁版槸鍚︽槸绗�5涓�
         })
-        // that.tabsHeight('.page' + e.target.dataset.current); //鏌ヨ鍝竴涓厓绱�
       }
     },
     bindChange: function (e) {
       var that = this;
       that.setData({
         currentTab: e.detail.current,
-        navScrollLeft: e.detail.current >= 3 ? ((e.detail.current) * 60) : 0 //鍒ゆ柇褰撳墠閫変腑鐨勪釜鏁版槸鍚︽槸绗�5涓�
       });
-      that.tabsHeight('.page' + e.detail.current); //鏌ヨ鍝竴涓厓绱�        
+      that.tabsHeight('.page' + e.detail.current); //鏌ヨ鍝竴涓厓绱�
+      this.triggerEvent('tabchange', this.data.currentTab)
     },
   }
 })
\ No newline at end of file

--
Gitblit v1.9.3