|
@@ -8,7 +8,7 @@
|
|
|
<uni-icons v-if="!inputVal || !clearAble" :type="showSelector ? 'top' : 'bottom'" size="14" color="#999" @click="toggleSelector"> </uni-icons>
|
|
|
<uni-icons v-if="inputVal && clearAble" type="clear" size="24" color="#999" @click="clean"> </uni-icons>
|
|
|
</view>
|
|
|
- <view class="uni-combox__selector" v-if="showSelector">
|
|
|
+ <view class="uni-combox__selector" v-if="showSelector" ref="dropdownRef">
|
|
|
<view class="uni-popper__arrow"></view>
|
|
|
<scroll-view scroll-y="true" class="uni-combox__selector-scroll">
|
|
|
<view class="uni-combox__selector-empty" v-if="candidates.length === 0">
|
|
@@ -128,9 +128,12 @@ export default {
|
|
|
onFocus() {
|
|
|
this.showSelector = true;
|
|
|
},
|
|
|
- onBlur() {
|
|
|
+ onBlur(event) {
|
|
|
setTimeout(() => {
|
|
|
- this.showSelector = false;
|
|
|
+ const dropdown = this.$refs.dropdownRef;
|
|
|
+ if (dropdown && !dropdown.contains(event.relatedTarget)) {
|
|
|
+ this.showSelector = false;
|
|
|
+ }
|
|
|
}, 154);
|
|
|
},
|
|
|
onSelectorClick(text, index) {
|