From 4bd7f716cd07bc974074d17c8864c47092725900 Mon Sep 17 00:00:00 2001 From: "YLHEALTH\\jackson.li" Date: Fri, 11 Jan 2019 13:44:27 +0800 Subject: [PATCH] update totalPrice() (change const to let & remove :void --- src/app/p2/p2.component.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app/p2/p2.component.ts b/src/app/p2/p2.component.ts index 8e555f9..6191186 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; } -- 2.26.2