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