优化搜索
This commit is contained in:
@@ -8,17 +8,17 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="search">
|
<view class="search">
|
||||||
<!-- 搜索 、 -->
|
<!-- 搜索 -->
|
||||||
<u-sticky>
|
<u-sticky>
|
||||||
<view class="header-search">
|
<view class="header-search">
|
||||||
<u-search placeholder="输入用户账号、手机号" searchIcon="search" @custom="search" v-model="searchValue"
|
<u-search placeholder="输入用户账号、手机号" searchIcon="search" @custom="search" v-model="searchValue"
|
||||||
@search="search" bgColor="#f9f9f9" :focus="focused" />
|
@search="search" bgColor="#F3F6FB" :focus="focused" />
|
||||||
</view>
|
</view>
|
||||||
</u-sticky>
|
</u-sticky>
|
||||||
<block v-if="searchResult.length > 0">
|
<block v-if="searchResult.length > 0">
|
||||||
<applyFriend :lists="searchResult" :isApply="true" @action="action" />
|
<applyFriend :lists="searchResult" :isApply="true" @action="action" />
|
||||||
</block>
|
</block>
|
||||||
<view class="no-lists" v-else>
|
<view class="no-lists" v-if="searchResult.length === 0 && searchValue.length > 1">
|
||||||
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
|
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
|
||||||
:src="require('@/static/imgs/no-search.png')" :lazy-load="true" />
|
:src="require('@/static/imgs/no-search.png')" :lazy-load="true" />
|
||||||
<span>暂无匹配内容~</span>
|
<span>暂无匹配内容~</span>
|
||||||
@@ -43,6 +43,20 @@
|
|||||||
focused: true
|
focused: true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
searchValue(value) {
|
||||||
|
console.log(value.length, 'length...')
|
||||||
|
if (value.length > 1) {
|
||||||
|
this.searchResult = []
|
||||||
|
this.search()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(value.length === 0){
|
||||||
|
this.searchResult = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
search() {
|
search() {
|
||||||
// friendship: '' 没有好友关系
|
// friendship: '' 没有好友关系
|
||||||
|
|||||||
Reference in New Issue
Block a user