本文实例为大家分享了vue实现购物车的具体代码,供大家参考,具体内容如下
购物车案例 *{ padding: 0; margin:0 } ul li{ width: 1200px; display: flex; align-items: center; justify-content: center; } li div,.total{ display: inline-block; width:200px; height: 50px; line-height: 50px; text-align: center; } button{ width: 60px; height: 40px; text-align: center; line-height: 40px; }
{handleCount(type,item)}" @ondelete="()=>{handleDelete(item.id)}"> 总价:{{total}}
实现效果图:
小编再为大家分享一段收藏的vue购物车逻辑代码,也谢谢原作者的分享
{{item.title}}
¥{{item.price}}
-
{{item.num}}
+
×
全选
¥{{totalPrice}}
购物车是空的哦~
.cart-box{
padding-bottom: 50px;
}
.cart-list{
position: relative;
padding: 10px 10px 10px 142px;
height: 92px;
border-bottom: 1px solid #e9e9e9;
}
.cart-list .cart-pro-select{
position: absolute;
left: 10px;
top: 45px;
width: 25px;
height: 25px;
}
.cart-list .cart-thumb{
position: absolute;
top: 10px;
left: 42px;
width: 92px;
height: 92px;
}
.cart-list .cart-pro-name{
display: inline-block;
width: 150px;
height: 52px;
line-height: 25px;
overflow: hidden;
}
.cart-list .cart-pro-price{
display: inline-block;
float: right;
height: 52px;
line-height: 25px;
}
.cart-list .cart-count-box{
position: absolute;
left: 142px;
bottom: 10px;
width: 125px;
height: 40px;
}
.cart-list .cart-count-box p{
display: inline-block;
line-height: 40px;
p-align: center;
}
.cart-count-down,.cart-count-add{
position: absolute;
top:-5px;
font-size: 22px;
width: 25px;
height: 100%;
}
.cart-count-num{
margin-left: 17px;
width: 75px;
}
.cart-del{
position: absolute;
right: 10px;
bottom: 0px;
width: 40px;
height: 40px;
line-height: 40px;
p-align: center;
font-size: 22px;
}
.cart-footer{
position: fixed;
bottom: 15%;
left: 0;
width: 100%;
height: 45px;
line-height: 45px;
box-sizing: border-box;
background: #AB956D;
color: #fff;
}
.total-select{
position: absolute;
left: 10px;
top: 12px;
width: 22px;
height: 22px;
}
.order-icon{
position: absolute;
right: 20px;
top: 12px;
width: 24px;
height: 24px;
}
.order-icon image,.order-icon navigator{
display: block;
width: 24px;
height: 24px;
}
.cart-toatl-price{
float: right;
width: 60px;
}
.cart-no-data{
padding:20px 0;
color: #999;
p-align: center;
}
更多文章可以点击《Vue.js前端组件学习教程》学习阅读。
关于vue.js组件的教程,请大家点击专题vue.js组件学习教程进行学习。
更多vue学习教程请阅读专题《vue实战教程》
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



