Showing
1 changed file
with
5 additions
and
2 deletions
| @@ -49,7 +49,7 @@ export struct SearchComponent { | @@ -49,7 +49,7 @@ export struct SearchComponent { | ||
| 49 | getRelatedSearchContent() { | 49 | getRelatedSearchContent() { |
| 50 | if(StringUtils.isNotEmpty(this.searchText)){ | 50 | if(StringUtils.isNotEmpty(this.searchText)){ |
| 51 | SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText),getContext(this)).then((value) => { | 51 | SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText),getContext(this)).then((value) => { |
| 52 | - if (value != null) { | 52 | + if (value != null && value.length > 0) { |
| 53 | this.relatedSearchContentsData = [] | 53 | this.relatedSearchContentsData = [] |
| 54 | value.forEach(item=>{ | 54 | value.forEach(item=>{ |
| 55 | let tempValue:string = item | 55 | let tempValue:string = item |
| @@ -81,6 +81,9 @@ export struct SearchComponent { | @@ -81,6 +81,9 @@ export struct SearchComponent { | ||
| 81 | this.relatedSearchContentsData.push(new SearchRelatedItem(item,tempArr)) | 81 | this.relatedSearchContentsData.push(new SearchRelatedItem(item,tempArr)) |
| 82 | } | 82 | } |
| 83 | }) | 83 | }) |
| 84 | + }else{ | ||
| 85 | + this.hasInputContent = false | ||
| 86 | + this.relatedSearchContentsData = [] | ||
| 84 | } | 87 | } |
| 85 | }).catch((err: Error) => { | 88 | }).catch((err: Error) => { |
| 86 | console.log(TAG, JSON.stringify(err)) | 89 | console.log(TAG, JSON.stringify(err)) |
| @@ -228,7 +231,7 @@ export struct SearchComponent { | @@ -228,7 +231,7 @@ export struct SearchComponent { | ||
| 228 | Row() { | 231 | Row() { |
| 229 | //左 | 232 | //左 |
| 230 | Stack({ alignContent: Alignment.Start }) { | 233 | Stack({ alignContent: Alignment.Start }) { |
| 231 | - if (this.searchTextData != null && this.searchTextData.length > 0 && !this.hasInputContent) { | 234 | + if (this.searchTextData != null && this.searchTextData.length > 0 && !this.hasInputContent && StringUtils.isEmpty(this.searchText)) { |
| 232 | Swiper(this.swiperController) { | 235 | Swiper(this.swiperController) { |
| 233 | ForEach(this.searchTextData, (item: string, index: number) => { | 236 | ForEach(this.searchTextData, (item: string, index: number) => { |
| 234 | Text(item) | 237 | Text(item) |
-
Please register or login to post a comment