From 5a678cce1b157411f20fbddfaed49c7bc8d9fba7 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 07 十一月 2024 17:03:13 +0800
Subject: [PATCH] 修改为生产模式

---
 miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.js |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.js b/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.js
index 04d9611..6463cbf 100644
--- a/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.js
+++ b/miniprogram_npm/tdesign-miniprogram/collapse-panel/collapse-panel.js
@@ -21,14 +21,12 @@
             '../collapse/collapse': {
                 type: 'ancestor',
                 linked(target) {
-                    this.parent = target;
-                    const { value, defaultExpandAll, expandMutex, expandIcon, disabled } = target.properties;
-                    const activeValues = defaultExpandAll && !expandMutex ? [this.properties.value] : value;
+                    const { value, expandIcon, disabled } = target.properties;
                     this.setData({
                         ultimateExpandIcon: expandIcon || this.properties.expandIcon,
                         ultimateDisabled: this.properties.disabled == null ? disabled : this.properties.disabled,
                     });
-                    this.updateExpanded(activeValues);
+                    this.updateExpanded(value);
                 },
             },
         };
@@ -42,16 +40,13 @@
             ultimateDisabled: false,
         };
         this.methods = {
-            set(data) {
-                this.setData(data);
-                return new Promise((resolve) => wx.nextTick(resolve));
-            },
-            updateExpanded(activeValues) {
-                if (!this.parent) {
+            updateExpanded(activeValues = []) {
+                if (!this.$parent || this.data.ultimateDisabled) {
                     return;
                 }
                 const { value } = this.properties;
-                const expanded = activeValues.includes(value);
+                const { defaultExpandAll } = this.$parent.data;
+                const expanded = defaultExpandAll ? !this.data.expanded : activeValues.includes(value);
                 if (expanded === this.properties.expanded)
                     return;
                 this.setData({ expanded });
@@ -79,7 +74,12 @@
                 const { value } = this.properties;
                 if (ultimateDisabled)
                     return;
-                this.parent.switch(value);
+                if (this.$parent.data.defaultExpandAll) {
+                    this.updateExpanded();
+                }
+                else {
+                    this.$parent.switch(value);
+                }
             },
         };
     }

--
Gitblit v1.9.3