setFormatter 为兼容微信小程序而暴露的内部方法
mounted() {
//如果是在页面则使用onReady
this.$refs.Input.setFormatter(this.formate)
},
methods: {
formate(e){
if(parseInt(e)>parseInt(this.ticketInfo.num)){
uni.showToast({
title: '不能大于'+this.ticketInfo.num,
icon:'none'
})
return parseInt(this.ticketInfo.num)
}else{
return parseInt(e)
}
}
<u-input
ref="Input"
type="number"
border="none"
v-model="value"
@change="change"
inputAlign='center'
color='#030303'
fontSize='30rpx'
>
<!-- <text slot='suffix'>张</text> -->
</u-input>