下拉框搜索

This commit is contained in:
2023-04-27 18:47:58 +08:00
parent 9783c1debe
commit 386ea12405
2 changed files with 47 additions and 14 deletions

View File

@@ -12,7 +12,8 @@
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
<view class="uni-select__selector" v-if="showSelector">
<view class="uni-popper__arrow"></view>
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
<input v-if="searchInput === true" type="text" class="filter_input filter_input_s" :value="svalue" @input="handleInput($event)">
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
<text>{{emptyTips}}</text>
</view>
@@ -60,6 +61,14 @@
default () {
return []
}
},
searchInput: {
type: Boolean,
default: false
},
svalue: {
type: [String, Number],
default: ''
},
value: {
type: [String, Number],
@@ -138,7 +147,11 @@
}
}
},
methods: {
methods: {
handleInput($event) {
this.$emit('input', $event.target.value)
this.$emit('handleChange', $event.target.value)
},
initDefVal() {
let defValue = ''
if ((this.value || this.value === 0) && !this.isDisabled(this.value)) {
@@ -181,7 +194,7 @@
return isDisabled;
},
clearVal() {
clearVal() {
this.emit('')
if (this.collection) {
uni.removeStorageSync(this.last)
@@ -423,5 +436,9 @@
bottom: 0;
right: 0;
left: 0;
}
.filter_input_s {
width: calc(100% - 30rpx);
margin: 0 20rpx 0 10rpx;
}
</style>