From d2ab2250d960af216f8f8fb70a3183eeb5a6a1cd Mon Sep 17 00:00:00 2001 From: ewall <1054064180@qq.com> Date: Thu, 30 Aug 2018 11:39:18 +0800 Subject: [PATCH] 'add' --- README.md | 2 +- src/components/goodsItem.vue | 27 ++++++++---- src/view/goodList.vue | 79 ++++++++++++++++++++++++------------ static/mock/goodsList.json | 48 ++++++++++++++++++++++ 4 files changed, 119 insertions(+), 37 deletions(-) create mode 100644 static/mock/goodsList.json diff --git a/README.md b/README.md index 6ce5e4f..997413b 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -父子组件之间的传值 \ No newline at end of file +chapter24、商品列表页之数据渲染和传值 \ No newline at end of file diff --git a/src/components/goodsItem.vue b/src/components/goodsItem.vue index 447e79b..ec096b3 100644 --- a/src/components/goodsItem.vue +++ b/src/components/goodsItem.vue @@ -1,10 +1,10 @@ @@ -13,8 +13,17 @@ export default { name: "goodsItem", props: { - message: { + img: String, + desc: { type: String, + default: "请输入商品描述" + }, + price: { + type: null, + default: "商品价格" + }, + discount: { + type: null, default: "hello" } }, @@ -35,15 +44,15 @@ export default { height: 6rem; } .goods_desc { - padding: .133333rem .133333rem; + padding: 0.133333rem 0.133333rem; font-size: @sizeS; - color: @fontColor1;; + color: @fontColor1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .goods_price { - padding: 0 .133333rem; + padding: 0 0.133333rem; // display: flex; // flex-direction: row; // justify-content: space-between; @@ -55,7 +64,7 @@ export default { font-size: @sizeM; color: @fontColor2; text-decoration: line-through; - margin-left: .213333rem; + margin-left: 0.213333rem; } } } diff --git a/src/view/goodList.vue b/src/view/goodList.vue index bf7373c..70c2d30 100644 --- a/src/view/goodList.vue +++ b/src/view/goodList.vue @@ -1,39 +1,42 @@