vue实现商品加减计算总价的实例代码实现商品加减计算总价的实例代码
主要介绍了vue实现商品加减计算总价的实例代码,代码简单易懂,非常不错,具有一定的参考借鉴价值,需要的
朋友可以参考下
需求是商品只能选一次,有原价和现价.
大概的效果图是这样:
完整代码在这里,直接复制就能用:
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
html{
background: rgb(214,175,209);
}
/*计算器*/
#app{
text-align: center;
margin-top: 8%;
position: relative;
}
.goods_box{
width: 70vw;
margin-left:15vw;
height: auto;
margin-top: 5%;
}
.goods_box ul{
width: 100%;
overflow:auto;
}
.goods_box ul li{
float: left;
width: 23%;
height: auto;
cursor: pointer;
margin: 2% 1%;
font-size: 0.6rem;
background: #fff;
display: flex;
align-items: center;
align-content: center;
padding-bottom: 1%;
border-radius: 4px;
}
.goods_img{
width: 40%;
border-radius: 6px;
height: auto;
margin-left: -4%;
margin-top: -4%;
box-shadow: 3px 3px 2px rgba(0,0,0,.24);
}
.price{
margin-left: 6%;
text-align: left;
}
.or_price{
color: rgba(242,58,58,0.8);
text-decoration: line-through;
}
.goods_name{
margin-top: 4%;
}
.now_and_or{
margin-top: 5%;
}
.now_price{
font-size: 1rem;
}
/*计算结果的盒子*/
- 1
- 2
前往页