From 537ec5598016ed4fcfbea8f8d27653996896f816 Mon Sep 17 00:00:00 2001
From: "YLHEALTH\\jackson.li"
Date: Fri, 21 Dec 2018 17:34:52 +0800
Subject: [PATCH] no message
---
src/app/P2.html | 0
src/app/app.component.html | 17 +++++------------
src/app/app.component.ts | 20 +++++---------------
3 files changed, 10 insertions(+), 27 deletions(-)
create mode 100644 src/app/P2.html
diff --git a/src/app/P2.html b/src/app/P2.html
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/app.component.html b/src/app/app.component.html
index d9292d7..65ed4b3 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -3,10 +3,10 @@
單品:
單價:
數量:
+ 你購買 {{ name }} 商品,單價 {{ price }} 元,數量{{ quantity }}元,共計NT${{ price * quantity}} 元
-{{message}}
-
+
@@ -18,9 +18,9 @@
小計 |
-
+
- |
+ |
{{ message.name }} |
{{ message.price }} |
{{ message.quantity }} |
@@ -29,14 +29,7 @@
加總 |
- |
+ {{total}} |
-
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 7ff3fd2..ed74540 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -16,33 +16,23 @@ export class AppComponent {
messages: Message[] = [];
+ result = 0;
+
addMessage(): void {
// 防呆,避免名稱或內容是空值時也可以留言
if (
- !this.name.trim() && !this.messages.trim() && !this.quantity.trim()
+ !this.name.trim() && !this.price.trim() && !this.quantity.trim()
) {
return;
}
-
// 用名稱跟內容產生一個留言的資料物件
const message = new Message(this.name, this.price, this.quantity);
-
// 將留言的資料物件放進容器裡
this.messages.push(message);
}
-
- total():void {
+ deleteItem(): void {
+ alert('清空啦');
}
-
- buildMessage(): void {
-
- }
-
- remove(): void {
- this.messages.remove(new Message);
- }
-
-
}
--
2.26.2