搜索栏添加扫码查询功能

feasure
lld 2026-02-16 11:39:12 +08:00
parent b88ebaeeee
commit 384112c81f
2 changed files with 13 additions and 3 deletions

View File

@ -18,9 +18,13 @@
v-model="searchValue" v-model="searchValue"
cancelButton="always" cancelButton="always"
@input="input" @input="input"
clearButton="always"
@cancel="cancel" @cancel="cancel"
@clear="cancel" @clear="cancel"
placeholder="请输入搜索内容"> placeholder="请输入搜索内容">
<template v-slot:searchIcon>
<yt-scanCode @getScanCode="getScanCode"></yt-scanCode>
</template>
</uni-search-bar> </uni-search-bar>
</uni-col> </uni-col>
</uni-row> </uni-row>
@ -153,10 +157,15 @@ export default {
onShow() { onShow() {
this.refresh(); this.refresh();
}, },
onReady() { onReady() {
}, },
methods: { methods: {
getScanCode(res){
this.searchValue = res;
this.value = 1;
},
handleAddAgri() { handleAddAgri() {
this.$refs.addAgri.open(); this.$refs.addAgri.open();
// //
@ -321,6 +330,7 @@ page {
margin-top: 10rpx; margin-top: 10rpx;
/* 新增H5端避免滚动条样式不一致 */ /* 新增H5端避免滚动条样式不一致 */
scrollbar-width: thin; scrollbar-width: thin;
height: 1220rpx;
} }
/* H5端滚动条样式优化可选 */ /* H5端滚动条样式优化可选 */
.list-scroll::-webkit-scrollbar { .list-scroll::-webkit-scrollbar {
@ -512,9 +522,9 @@ page {
background: transparent !important; background: transparent !important;
} }
/* 强制隐藏搜索图标容器 */ /* 强制隐藏搜索图标容器 */
/deep/ .uni-searchbar__box-icon-search { /*/deep/ .uni-searchbar__box-icon-search {
display: none !important; display: none !important;
} }*/
/deep/ .uni-section .uni-section-header { /deep/ .uni-section .uni-section-header {
padding: 12rpx 10rpx; padding: 12rpx 10rpx;
} }

View File

@ -37,7 +37,7 @@
} }
}, },
fail: err => { fail: err => {
console.log(JSON.stringify(err)) console.log("当前环境不支持!")
} }
}) })