mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-09-10 14:59:46 +08:00
[bugfix] Collapse: remove reference from children of collapse when collapse-item unlinked
fix #1515
This commit is contained in:
parent
40ab808f02
commit
1d1970a7f6
@ -6,6 +6,11 @@ VantComponent({
|
|||||||
type: 'descendant',
|
type: 'descendant',
|
||||||
linked(child: Weapp.Component) {
|
linked(child: Weapp.Component) {
|
||||||
this.children.push(child);
|
this.children.push(child);
|
||||||
|
},
|
||||||
|
unlinked(child: Weapp.Component) {
|
||||||
|
this.children = this.children.filter(
|
||||||
|
(item: Weapp.Component) => item !== child
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -40,7 +45,9 @@ VantComponent({
|
|||||||
if (!accordion) {
|
if (!accordion) {
|
||||||
name = expanded
|
name = expanded
|
||||||
? (value || []).concat(name)
|
? (value || []).concat(name)
|
||||||
: (value || []).filter((activeName: string | number) => activeName !== name);
|
: (value || []).filter(
|
||||||
|
(activeName: string | number) => activeName !== name
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
name = expanded ? name : '';
|
name = expanded ? name : '';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user