From 055a95083699e02347d2d593888c4f740d93ea79 Mon Sep 17 00:00:00 2001 From: "YLHEALTH\\jackson.li" Date: Fri, 11 Jan 2019 09:54:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8AtotalPrice()=E7=A8=8D=E4=BD=9C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=A7=A3=E6=B1=BAsever=20-o=20=E7=84=A1?= =?UTF-8?q?=E6=B3=95display?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/home/home.component.html | 2 +- src/app/p2/p2.component.ts | 9 ++++----- src/app/p3/p3.component.html | 10 ++++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 5acc7ff..cb12767 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -94,7 +94,7 @@ cnt:
{{ item2.description }} - + {{ item.speed }} meter/sec diff --git a/src/app/p2/p2.component.ts b/src/app/p2/p2.component.ts index 8e555f9..7ab1980 100644 --- a/src/app/p2/p2.component.ts +++ b/src/app/p2/p2.component.ts @@ -16,7 +16,7 @@ export class P2Component implements OnInit { datas: Data[] = []; - // result = 0; + result: any; total: any; message = ''; @@ -49,13 +49,12 @@ export class P2Component implements OnInit { } totalPrice(): void { - const result = 0; for ( const i = 0; i < this.datas.length; i++ - ) { const data = this.datas[i]; - result = result + data.total; + ) { const data = this.datas; + this.result = this.result + data[i].total; } - return result; + return this.result; } deleteItem(name, i): void { diff --git a/src/app/p3/p3.component.html b/src/app/p3/p3.component.html index a4ccb75..ecf0629 100644 --- a/src/app/p3/p3.component.html +++ b/src/app/p3/p3.component.html @@ -1,10 +1,12 @@

題三

- - WidthLength :
- HeightLength :
+

+ WidthLength :
+ HeightLength :
- +

-- 2.26.2