typescript 秋田books.query.ts

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了typescript 秋田books.query.ts相关的知识,希望对你有一定的参考价值。

export class BooksQuery extends QueryEntity<BooksState, Book> {
  
  constructor(protected store: BooksStore) {
    super(store);
  }

  selectSearchTerm$ = this.select(state => state.searchTerm);
  selectResultIds$ = this.select(state => state.resultIds);
  selectCollection$ = this.select(state => state.collection);

  isInCollection$ = this.selectCollection$.pipe(map(ids => ids.includes(this.getActiveId()) === true))

  get getSearchTerm() {
    return this.getSnapshot().searchTerm;
  }
  
  get collection() {
    return this.getSnapshot().collection;
  }

  get nonCollectionBooks(): string[] {
    return this.getAll({
      filterBy: ({ id }) => this.collection.includes(id) === false
    }).map(({ id }) => id);
  }

}

以上是关于typescript 秋田books.query.ts的主要内容,如果未能解决你的问题,请参考以下文章

typescript 秋田SelectedBookPageComponent.ts

typescript 秋田ViewBookPageComponent.ts

typescript 秋田CollectionPageComponent.ts

typescript 秋田books.service.ts

typescript 秋田books.store.ts

typescript 秋田app.component.ts