File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 < mat-card class ="book-card ">
66 < ion-badge color ="warning "
77 style ="position: absolute; right: -5px; top: -10px; "
8- *ngIf ="book.recordList ">
8+ *ngIf ="book.recordList && book.recordList.length > 0 ">
99 {{book.recordList.length}}次阅读
1010 </ ion-badge >
1111 < mat-card-title > {{book.name | uppercase}}</ mat-card-title >
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ export class BookService {
4545 // `deleted` 是可选参数,没有时是 `undefined`, `!undefined`为真,传入`true`时`!true`为假
4646 listUpdated = ( book : Book , deleted ?: boolean ) => {
4747 const index = this . list . findIndex ( b => b . id === book . id ) ;
48- this . list . splice ( index , 1 ) ;
48+ if ( index >= 0 ) this . list . splice ( index , 1 ) ;
4949 if ( ! deleted ) this . list . push ( book ) ;
5050
5151 const msg : IMessage = {
@@ -74,6 +74,7 @@ export class BookService {
7474 newBook . website = await this . website . newWebsit ( site ) ;
7575 newBook . writer = await this . writer . newWriter ( writerName , newBook . website ) ;
7676 newBook . cateList = await this . cate . saveList ( res . cateList ) ;
77+ newBook . recordList = [ ] ;
7778
7879 const query : IQuery = {
7980 table : 'Book' ,
You can’t perform that action at this time.
0 commit comments