parent
c35c53d830
commit
f5ecd16777
2 changed files with 31 additions and 17 deletions
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<li :class="[prefixCls + '-wrap']">
|
||||
<li :class="[prefixCls + '-wrap']" v-show="!hidden">
|
||||
<div :class="[prefixCls + '-title']">{{ label }}</div>
|
||||
<ul>
|
||||
<li :class="[prefixCls]"><slot></slot></li>
|
||||
<li :class="[prefixCls]" v-el:options><slot></slot></li>
|
||||
</ul>
|
||||
</li>
|
||||
</template>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue