加减按钮
<view class="carts-num">
<!--减按钮 -->
<lable class="minus" bindtap="btn_minus">-</lable>
<!-- 文本框值 -->
<label class="view_text_center" bindinput='input_num'>{{num}}</label>
<!-- 加按钮-->
<lable class="plus" bindtap="btn_add">+</lable>
</view>
// 点击加号
btn_add:function(){
this.data.num++;
var numa = this.data.num++;
this.setData({
num: numa
})
},
// 点击减号
btn_minus:function(){
this.data.num--;
var numj=this.data.num;
this.setData({
num:numj
})
}
/*数量加减*/
.carts-num{
position: absolute;
right: 30rpx;
bottom: 23rpx;
display: flex; align-items: center; text-align: center; height: 50rpx;}
.view_text_center{border: 1rpx solid #ebebeb;font-size: 30rpx;
display: inline-block;color: #333;height: 50rpx;line-height: 50rpx; width: 76rpx;}
.carts-num .minus, .carts-num .plus{margin: 10rpx; border: 1rpx solid #ebebeb;color: #000; text-align: center;height: 50rpx; line-height: 50rpx; width: 40rpx;}
.carts-num .minus{font-size: 34rpx;}
.carts-num .plus{font-size: 34rpx;}
小程序加减按钮
最新推荐文章于 2022-11-10 10:26:17 发布