From 7edc605f3e3ea6750c2c911fee41ea5b5da9675d Mon Sep 17 00:00:00 2001 From: Mike Huang Date: Sat, 9 Mar 2024 20:23:19 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20search=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/query/query.component.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/app/query/query.component.ts b/src/app/query/query.component.ts index f83b272e77..14daeca6e4 100644 --- a/src/app/query/query.component.ts +++ b/src/app/query/query.component.ts @@ -5,7 +5,15 @@ import { MatCardModule } from '@angular/material/card'; import { MatListModule } from '@angular/material/list'; import { MatToolbarModule } from '@angular/material/toolbar'; import { ActivatedRoute, RouterLink } from '@angular/router'; -import { Observable, combineLatest, defer, filter, map, startWith, switchMap } from 'rxjs'; +import { + Observable, + combineLatest, + defer, + filter, + map, + startWith, + switchMap, +} from 'rxjs'; import { SitePostService } from '../site-common/site-post.service'; @Component({ @@ -25,7 +33,7 @@ import { SitePostService } from '../site-common/site-post.service'; -

共 {{ searchResult.length }} 篇文章

+

共 {{ searchResult().length }} 篇文章

@if (searchDateStart()) { @@ -106,7 +114,7 @@ export class QueryComponent { private route = inject(ActivatedRoute); private searchKeyword$ = this.route.queryParamMap.pipe( - map((queryParamMap) => `${queryParamMap.get('q')}`), + map((queryParamMap) => queryParamMap.get('q')), filter(Boolean), startWith('') );