下拉选不收回

This commit is contained in:
hongchao 2025-09-17 21:16:50 +08:00
parent dfcd7d8678
commit d1831e7428
2 changed files with 21 additions and 6 deletions

View File

@ -115,6 +115,7 @@
:localdata="codeRange"
@change="changeCode"
@click="handleMaCode"
:keepOpen="true"
></uni-data-select>
</uni-col>
</uni-row>

View File

@ -37,7 +37,7 @@
/>
</view>
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
<view class="uni-select--mask" v-if="showSelector" @click="closeSelector" />
<view class="uni-select__selector" :style="getOffsetByPlacement" v-if="showSelector">
<view
:class="placement == 'bottom' ? 'uni-popper__arrow_bottom' : 'uni-popper__arrow_top'"
@ -137,6 +137,10 @@ export default {
type: Boolean,
default: true,
},
keepOpen: {
type: Boolean,
default: false,
},
},
data() {
return {
@ -244,8 +248,11 @@ export default {
},
change(item) {
if (!item.disable) {
this.showSelector = false
this.showInput = false
// keepOpenfalse
if (!this.keepOpen) {
this.showSelector = false
this.showInput = false
}
this.searchValue = ''
this.current = this.formatItemName(item)
this.emit(item.value)
@ -263,13 +270,20 @@ export default {
this.showSelector = true
this.searchValue = ''
},
closeSelector() {
//
this.showInput = false
this.showSelector = false
},
onSearchInput(val) {
this.searchValue = val
},
onInputBlur() {
// blur
setTimeout(() => {
if (this.showSelector) {
// keepOpenfalse
if (this.showSelector && !this.keepOpen) {
this.showInput = false
this.showSelector = false
}