mirror of https://github.com/ElemeFE/element
parent
15dc895ee6
commit
0ccd537cc8
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<ul class="el-select-group__wrap">
|
||||
<li class="el-select-group__title">{{ label }}</li>
|
||||
<li class="el-select-group__title" v-show="visible">{{ label }}</li>
|
||||
<li>
|
||||
<ul class="el-select-group">
|
||||
<slot></slot>
|
||||
|
@ -17,6 +17,8 @@
|
|||
|
||||
name: 'el-option-group',
|
||||
|
||||
componentName: 'ElOptionGroup',
|
||||
|
||||
props: {
|
||||
label: String,
|
||||
disabled: {
|
||||
|
@ -25,12 +27,30 @@
|
|||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
visible: true
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
disabled(val) {
|
||||
this.broadcast('ElOption', 'handleGroupDisabled', val);
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
queryChange() {
|
||||
this.visible = this.$children &&
|
||||
Array.isArray(this.$children) &&
|
||||
this.$children.some(option => option.visible === true);
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.$on('queryChange', this.queryChange);
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (this.disabled) {
|
||||
this.broadcast('ElOption', 'handleGroupDisabled', this.disabled);
|
||||
|
|
|
@ -228,9 +228,11 @@
|
|||
this.broadcast('ElOption', 'resetIndex');
|
||||
} else if (typeof this.filterMethod === 'function') {
|
||||
this.filterMethod(val);
|
||||
this.broadcast('ElOptionGroup', 'queryChange');
|
||||
} else {
|
||||
this.filteredOptionsCount = this.optionsCount;
|
||||
this.broadcast('ElOption', 'queryChange', val);
|
||||
this.broadcast('ElOptionGroup', 'queryChange');
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue