diff --git a/src/app/p2/p2.component.ts b/src/app/p2/p2.component.ts index 8e555f9dc4ef08b85a44ab8b85f8dee4937d956f..61911866a18953bd691e0068d03412ce69ccc908 100644 --- a/src/app/p2/p2.component.ts +++ b/src/app/p2/p2.component.ts @@ -22,14 +22,14 @@ export class P2Component implements OnInit { message = ''; - buildMessage(): void { - if (this.name !== null && this.price !== null && this.quantity !== null && - this.name !== undefined && this.price !== undefined && this.quantity !== undefined - ) { - this.message = '你購買' + this.name + '商品,單價' + this.price + '元,數量' - + this.quantity + '元,共計NT$'; - } - } + // buildMessage(): void { + // if (this.name !== null && this.price !== null && this.quantity !== null && + // this.name !== undefined && this.price !== undefined && this.quantity !== undefined + // ) { + // this.message = '你購買' + this.name + '商品,單價' + this.price + '元,數量' + // + this.quantity + '元,共計NT$'; + // } + // } addData(): void { @@ -48,10 +48,10 @@ export class P2Component implements OnInit { } - totalPrice(): void { - const result = 0; + totalPrice() { + let result = 0; for ( - const i = 0; i < this.datas.length; i++ + let i = 0; i < this.datas.length; i++ ) { const data = this.datas[i]; result = result + data.total; }