本文实例为大家分享了微信小程序实现MUI数字输入框的具体代码,供大家参考,具体内容如下
效果图
WXML
WXSS
rush:css;">
.tui-number-group{
display: table;
table-layout: fixed;
width: 300rpx;
text-align: center;
border-radius: 6px;
border: 1px solid #bbb;
overflow: hidden;
}
.tui-number-cell{
display: table-cell;
line-height: 1.7;
border-radius: 0;
}
button::after{
border-bottom: none;
border-top: none;
border-radius: 0;
}
JS
= 10 ? 10 : this.data.number1 + 1,disabled1: this.data.number1 !== 0 ? false : true,disabled2: this.data.number1 !== 10 ? false : true
});
},nextNum1() {
this.setData({
number1: this.data.number1 <= 0 ? 0 : this.data.number1 - 1,disabled2: this.data.number1 !== 10 ? false : true
});
}
})
注意
button组件的边框和圆角设置在button::after,需要对其重置。