fix(接口测试): 场景折叠问题
This commit is contained in:
parent
5badcc3a21
commit
6383750485
|
@ -40,11 +40,11 @@
|
||||||
methods: {
|
methods: {
|
||||||
setActiveNames(activeNames, item) {
|
setActiveNames(activeNames, item) {
|
||||||
activeNames = [].concat(activeNames);
|
activeNames = [].concat(activeNames);
|
||||||
|
let value = this.accordion ? activeNames[0] : activeNames;
|
||||||
this.activeNames = activeNames;
|
this.activeNames = activeNames;
|
||||||
this.$emit('input', item.name);
|
this.$emit('input', value);
|
||||||
this.$emit('change', item.name);
|
|
||||||
},
|
},
|
||||||
handleItemClick(item) {
|
handleItemCollapseClick(item) {
|
||||||
if (this.accordion) {
|
if (this.accordion) {
|
||||||
this.setActiveNames(
|
this.setActiveNames(
|
||||||
(this.activeNames[0] || this.activeNames[0] === 0) && item.name, item);
|
(this.activeNames[0] || this.activeNames[0] === 0) && item.name, item);
|
||||||
|
@ -59,11 +59,15 @@
|
||||||
}
|
}
|
||||||
this.setActiveNames(activeNames, item);
|
this.setActiveNames(activeNames, item);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
handleItemClick(item) {
|
||||||
|
this.$emit('change', item.name);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.$on('item-click', this.handleItemClick);
|
this.$on('item-click', this.handleItemClick);
|
||||||
|
this.$on('collapse-click', this.handleItemCollapseClick);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
:aria-expanded="isActive"
|
:aria-expanded="isActive"
|
||||||
:aria-controls="`el-collapse-content-${id}`"
|
:aria-controls="`el-collapse-content-${id}`"
|
||||||
:aria-describedby="`el-collapse-content-${id}`"
|
:aria-describedby="`el-collapse-content-${id}`"
|
||||||
|
@click="handleHeaderClick"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="el-collapse-item__header"
|
class="el-collapse-item__header"
|
||||||
|
@ -20,10 +21,11 @@
|
||||||
@focus="handleFocus"
|
@focus="handleFocus"
|
||||||
@blur="focusing = false"
|
@blur="focusing = false"
|
||||||
>
|
>
|
||||||
<i @click="handleHeaderClick"
|
<div @click.stop="handleCollapseClick">
|
||||||
class="el-collapse-item__arrow el-icon-arrow-right"
|
<i class="el-collapse-item__arrow el-icon-arrow-right"
|
||||||
:class="{'is-active': isActive}">
|
:class="{'is-active': isActive}">
|
||||||
</i>
|
</i>
|
||||||
|
</div>
|
||||||
<slot name="title">{{title}}</slot>
|
<slot name="title">{{title}}</slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -102,6 +104,12 @@
|
||||||
this.focusing = false;
|
this.focusing = false;
|
||||||
this.isClick = true;
|
this.isClick = true;
|
||||||
},
|
},
|
||||||
|
handleCollapseClick() {
|
||||||
|
if (this.disabled) return;
|
||||||
|
this.dispatch('MsApiCollapse', 'collapse-click', this);
|
||||||
|
this.focusing = false;
|
||||||
|
this.isClick = true;
|
||||||
|
},
|
||||||
handleEnterClick() {
|
handleEnterClick() {
|
||||||
this.dispatch('MsApiCollapse', 'item-click', this);
|
this.dispatch('MsApiCollapse', 'item-click', this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue