下拉选不收回
This commit is contained in:
parent
dfcd7d8678
commit
d1831e7428
|
|
@ -115,6 +115,7 @@
|
|||
:localdata="codeRange"
|
||||
@change="changeCode"
|
||||
@click="handleMaCode"
|
||||
:keepOpen="true"
|
||||
></uni-data-select>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
// 只有当keepOpen为false时才关闭下拉框
|
||||
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) {
|
||||
// 只有当keepOpen为false时才关闭下拉框
|
||||
if (this.showSelector && !this.keepOpen) {
|
||||
this.showInput = false
|
||||
this.showSelector = false
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue