下拉选不收回
This commit is contained in:
parent
dfcd7d8678
commit
d1831e7428
|
|
@ -115,6 +115,7 @@
|
||||||
:localdata="codeRange"
|
:localdata="codeRange"
|
||||||
@change="changeCode"
|
@change="changeCode"
|
||||||
@click="handleMaCode"
|
@click="handleMaCode"
|
||||||
|
:keepOpen="true"
|
||||||
></uni-data-select>
|
></uni-data-select>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
|
|
@ -820,4 +821,4 @@ const ocrClick = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
/>
|
/>
|
||||||
</view>
|
</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="uni-select__selector" :style="getOffsetByPlacement" v-if="showSelector">
|
||||||
<view
|
<view
|
||||||
:class="placement == 'bottom' ? 'uni-popper__arrow_bottom' : 'uni-popper__arrow_top'"
|
:class="placement == 'bottom' ? 'uni-popper__arrow_bottom' : 'uni-popper__arrow_top'"
|
||||||
|
|
@ -137,6 +137,10 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
keepOpen: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -244,8 +248,11 @@ export default {
|
||||||
},
|
},
|
||||||
change(item) {
|
change(item) {
|
||||||
if (!item.disable) {
|
if (!item.disable) {
|
||||||
this.showSelector = false
|
// 只有当keepOpen为false时才关闭下拉框
|
||||||
this.showInput = false
|
if (!this.keepOpen) {
|
||||||
|
this.showSelector = false
|
||||||
|
this.showInput = false
|
||||||
|
}
|
||||||
this.searchValue = ''
|
this.searchValue = ''
|
||||||
this.current = this.formatItemName(item)
|
this.current = this.formatItemName(item)
|
||||||
this.emit(item.value)
|
this.emit(item.value)
|
||||||
|
|
@ -263,13 +270,20 @@ export default {
|
||||||
this.showSelector = true
|
this.showSelector = true
|
||||||
this.searchValue = ''
|
this.searchValue = ''
|
||||||
},
|
},
|
||||||
|
|
||||||
|
closeSelector() {
|
||||||
|
// 关闭下拉框
|
||||||
|
this.showInput = false
|
||||||
|
this.showSelector = false
|
||||||
|
},
|
||||||
onSearchInput(val) {
|
onSearchInput(val) {
|
||||||
this.searchValue = val
|
this.searchValue = val
|
||||||
},
|
},
|
||||||
onInputBlur() {
|
onInputBlur() {
|
||||||
// 延迟隐藏以防止点击选项时先触发blur
|
// 延迟隐藏以防止点击选项时先触发blur
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.showSelector) {
|
// 只有当keepOpen为false时才关闭下拉框
|
||||||
|
if (this.showSelector && !this.keepOpen) {
|
||||||
this.showInput = false
|
this.showInput = false
|
||||||
this.showSelector = false
|
this.showSelector = false
|
||||||
}
|
}
|
||||||
|
|
@ -447,4 +461,4 @@ export default {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue