微信小程序之购物车-——-微信小程序实战商城系列(5)(1) - background: #f5f5f5
为大家介绍的就是购物车
这里演示从商品列表中添加到购物车
下面先做商品列表页。如下图:
布局分析:
首先一个list的主盒子,接着是item盒子,这是必须的。 然后把item分成左侧的图片部分,和右侧的说明部分(item盒子使用横向弹性盒) 右侧的说明部分又分上下2部分(右侧说明部分盒子使用纵向弹性盒) 下面价钱购物车部分(下面价钱购物车部分也使用横向弹性盒,中间使用justify-content: space-between;填充空白)
index.wxml: 商品列表 更多
index.wxss:
/index.wxss/ page{
height: 100%; } .container{
background: #f5f5f5; }
.tit{
display: flex; flex-direction: row; justify-content: space-between; height: 30px; position: relative; } .tit::before{
content:‘’; background: #ffcc00; width:5px; height: 100%; position: absolute; left: 0; top: 0; }
.title_val{
padding: 0 15px; font-size: 14px; color: #555; line-height: 30px; } .more{
font-size: 12px; line-height: 30px; color: #999; padding: 0 5px 0 0 ; } .goodslist{
background: #fff; display: flex; flex-direction: column; } .goods{
display: flex; flex-direction: row; border-bottom: 1px solid #ddd; } .good-img{
padding: 5px; width: 80px; height: 80px; } .good-cont{
display: flex; flex: 1; flex-direction: column; font-size: 14px; } .goods-navigator{
display: flex; flex: 1; flex-direction: column; justify-content: center; } .good-name{ 拼多多帮助力入口
display: flex; flex: 1; flex-direction: column; color: #555; justify-content: center; } .good-price{<
精彩文章