搜索获取焦点

This commit is contained in:
2022-12-03 14:31:36 +08:00
parent 77d849739a
commit 404d5ad4aa
9 changed files with 25 additions and 7 deletions

View File

@@ -59,6 +59,11 @@ uni-button:after {
line-height: 70rpx; line-height: 70rpx;
color: #323232; color: #323232;
} }
.icon_del {
font-size: 48rpx;
line-height: 70rpx;
color: #323232;
}
.icon_search { .icon_search {
color: #323232; color: #323232;
line-height: 70rpx; line-height: 70rpx;

View File

@@ -4,8 +4,10 @@
type="text" type="text"
class="filter_input search_input" class="filter_input search_input"
:value="value" :value="value"
:focus="focused"
@input="handleChange($event)"> @input="handleChange($event)">
<view class="buttons_wraper"> <view class="buttons_wraper">
<span class="iconfont icon-del" @tap="toDel">&#xe6dc;</span>
<span class="iconfont icon_scan" @tap="toScan">&#xe6e2;</span> <span class="iconfont icon_scan" @tap="toScan">&#xe6e2;</span>
<span v-show="seaShow" class="iconfont icon_search" @tap="toSearch">&#xe6e1;</span> <span v-show="seaShow" class="iconfont icon_search" @tap="toSearch">&#xe6e1;</span>
</view> </view>
@@ -27,9 +29,13 @@
props: { props: {
value: String, value: String,
seaShow: { seaShow: {
type: Boolean, type: Boolean,
default: false default: false
}, },
focused: {
type: Boolean,
default: false
}
}, },
methods: { methods: {
handleChange ($event) { handleChange ($event) {
@@ -40,6 +46,9 @@
toSearch () { toSearch () {
this.$emit('toSearch', this.cur) this.$emit('toSearch', this.cur)
}, },
toDel () {
this.$emit('input', '')
},
async toScan() { async toScan() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
let status = await this.checkPermission(); let status = await this.checkPermission();
@@ -92,7 +101,7 @@
position relative position relative
_wh(100%, 70rpx) _wh(100%, 70rpx)
.search_input .search_input
padding-right: 140rpx; padding-right: 160rpx;
.buttons_wraper .buttons_wraper
position absolute position absolute
top 0 top 0

View File

@@ -10,6 +10,7 @@
<view class="filter_input_wraper"> <view class="filter_input_wraper">
<search-box <search-box
v-model="val1" v-model="val1"
:focused="true"
@handleChange="handleChange" @handleChange="handleChange"
/> />
</view> </view>

View File

@@ -10,6 +10,7 @@
<view class="filter_input_wraper"> <view class="filter_input_wraper">
<search-box <search-box
v-model="val1" v-model="val1"
:focused="true"
@handleChange="handleChange" @handleChange="handleChange"
/> />
</view> </view>

View File

@@ -8,7 +8,7 @@
<span class="filter_label">木箱</span> <span class="filter_label">木箱</span>
</view> </view>
<view class="filter_input_wraper"> <view class="filter_input_wraper">
<search-box v-model="val1" @handleChange="handleChange1" <search-box v-model="val1" :focused="true" @handleChange="handleChange1"
/> />
</view> </view>
</view> </view>

View File

@@ -10,6 +10,7 @@
<view class="filter_input_wraper"> <view class="filter_input_wraper">
<search-box <search-box
v-model="val1" v-model="val1"
:focused="true"
@handleChange="handleChange" @handleChange="handleChange"
/> />
</view> </view>

View File

@@ -10,6 +10,7 @@
<view class="filter_input_wraper"> <view class="filter_input_wraper">
<search-box <search-box
v-model="val1" v-model="val1"
:focused="true"
@handleChange="handleChange" @handleChange="handleChange"
/> />
</view> </view>

View File

@@ -8,7 +8,7 @@
<span class="filter_label">木箱</span> <span class="filter_label">木箱</span>
</view> </view>
<view class="filter_input_wraper"> <view class="filter_input_wraper">
<search-box v-model="val1" @handleChange="handleChange1" <search-box v-model="val1" :focused="true" @handleChange="handleChange1"
/> />
</view> </view>
</view> </view>

View File

@@ -8,7 +8,7 @@
<span class="filter_label">木箱</span> <span class="filter_label">木箱</span>
</view> </view>
<view class="filter_input_wraper"> <view class="filter_input_wraper">
<search-box v-model="val1" <search-box v-model="val1" :focused="true"
/> />
</view> </view>
</view> </view>