邓洁 : 修改搜索框bug

This commit is contained in:
dengj
2023-11-22 10:41:43 +08:00
parent 424d0bb7fa
commit 4bd637e4e9
8 changed files with 81 additions and 29 deletions

View File

@@ -4,7 +4,7 @@
<view class="bug-fix"></view>
<view class="search-box">
<view class="search-box-input">
<u-input placeholder="热门搜索" placeholder-style="color: #969696" prefixIcon="search"
<u-input v-model="keyword" placeholder="热门搜索" placeholder-style="color: #969696" prefixIcon="search"
prefixIconStyle="font-size: 24px;color: #909399;" border="true" @change="getInput">
</u-input>
</view>
@@ -39,7 +39,8 @@
customQuery: {},
shopListLength: '',
showNull: false,
refresh: false
refresh: false,
keyword: ''
}
},
onPullDownRefresh() {
@@ -59,6 +60,7 @@
},
onReachBottom() {
if (!this.refresh && this.shopListLength !== 0) {
this.keyword = ''
this.pageNum++
this.getShopList()
console.log("触底加载");
@@ -70,16 +72,16 @@
this.getShopList()
},
methods: {
getInput(val){
console.log('搜索值',val);
if(this.pageNum!==1){
this.pageNum=1
getInput(val) {
console.log('搜索值', val);
if (this.pageNum !== 1) {
this.pageNum = 1
}
const q = this.$u.queryParams({
type: 4,
pageSize: this.pageSize,
pageNum: this.pageNum,
kw:val
kw: val
})
this.$api.getShopList(q).then(res => {
this.shopListLength = res.data.data.length