diff --git a/src/components/select/option-group.vue b/src/components/select/option-group.vue
index b47f07e..ee5a3a2 100644
--- a/src/components/select/option-group.vue
+++ b/src/components/select/option-group.vue
@@ -1,8 +1,8 @@
-
+
{{ label }}
@@ -18,8 +18,30 @@
},
data () {
return {
- prefixCls: prefixCls
+ prefixCls: prefixCls,
+ hidden: false // for search
};
+ },
+ methods: {
+ queryChange () {
+ this.$nextTick(() => {
+ const options = this.$els.options.querySelectorAll('.ivu-select-item');
+ let hasVisibleOption = false;
+ for (let i = 0; i < options.length; i++) {
+ if (options[i].style.display !== 'none') {
+ hasVisibleOption = true;
+ break;
+ }
+ }
+ this.hidden = !hasVisibleOption;
+ });
+ }
+ },
+ events: {
+ 'on-query-change' () {
+ this.queryChange();
+ return true;
+ }
}
};
diff --git a/test/routers/select.vue b/test/routers/select.vue
index fb250cd..baa8108 100644
--- a/test/routers/select.vue
+++ b/test/routers/select.vue
@@ -1,16 +1,9 @@
-
-
-
- {{ item.label }}
-
-
-
-
- {{ item.label }}
-
-
-
+
+ {{ item.label }}
+ {{ item.label }}
+