From 0746b7bbe6aa3d9f02e03654a2cd4fde2081c335 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 21 四月 2025 09:29:40 +0800
Subject: [PATCH] bug修复
---
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