feat(CollapseItem): add toggle method (#7281)

* feat(CollapseItem): add toggle method

* chore: update doc
This commit is contained in:
neverland
2020-09-29 20:49:22 +08:00
committed by GitHub
parent 053a68e40d
commit 8d2c4b1e46
38 changed files with 132 additions and 50 deletions
+6 -4
View File
@@ -105,15 +105,17 @@ export default createComponent({
methods: {
onClick() {
if (this.disabled) {
return;
if (!this.disabled) {
this.toggle();
}
},
// @exposed-api
toggle(expanded = !this.expanded) {
const { parent, currentName } = this;
const close = parent.accordion && currentName === parent.value;
const name = close ? '' : currentName;
parent.switch(name, !this.expanded);
this.parent.switch(name, expanded);
},
onTransitionEnd() {