fix(接口测试): 场景折叠问题

This commit is contained in:
chenjianxing 2020-09-18 13:05:22 +08:00
parent 5badcc3a21
commit 6383750485
2 changed files with 19 additions and 7 deletions

View File

@ -40,11 +40,11 @@
methods: {
setActiveNames(activeNames, item) {
activeNames = [].concat(activeNames);
let value = this.accordion ? activeNames[0] : activeNames;
this.activeNames = activeNames;
this.$emit('input', item.name);
this.$emit('change', item.name);
this.$emit('input', value);
},
handleItemClick(item) {
handleItemCollapseClick(item) {
if (this.accordion) {
this.setActiveNames(
(this.activeNames[0] || this.activeNames[0] === 0) && item.name, item);
@ -59,11 +59,15 @@
}
this.setActiveNames(activeNames, item);
}
},
handleItemClick(item) {
this.$emit('change', item.name);
}
},
created() {
this.$on('item-click', this.handleItemClick);
this.$on('collapse-click', this.handleItemCollapseClick);
}
};
</script>

View File

@ -6,6 +6,7 @@
:aria-expanded="isActive"
:aria-controls="`el-collapse-content-${id}`"
:aria-describedby="`el-collapse-content-${id}`"
@click="handleHeaderClick"
>
<div
class="el-collapse-item__header"
@ -20,10 +21,11 @@
@focus="handleFocus"
@blur="focusing = false"
>
<i @click="handleHeaderClick"
class="el-collapse-item__arrow el-icon-arrow-right"
:class="{'is-active': isActive}">
</i>
<div @click.stop="handleCollapseClick">
<i class="el-collapse-item__arrow el-icon-arrow-right"
:class="{'is-active': isActive}">
</i>
</div>
<slot name="title">{{title}}</slot>
</div>
</div>
@ -102,6 +104,12 @@
this.focusing = false;
this.isClick = true;
},
handleCollapseClick() {
if (this.disabled) return;
this.dispatch('MsApiCollapse', 'collapse-click', this);
this.focusing = false;
this.isClick = true;
},
handleEnterClick() {
this.dispatch('MsApiCollapse', 'item-click', this);
}