修复bug

This commit is contained in:
weipengfei 2024-03-02 17:44:07 +08:00
parent 280435d80f
commit 472e8931f2

View File

@ -20,7 +20,7 @@
<view class="v-con-text">付款金额</view> <view class="v-con-text">付款金额</view>
<view class="v-con-input" style="margin-right: 10px;"> <view class="v-con-input" style="margin-right: 10px;">
<text style="color: #303133;font-size:46rpx;"></text> <text style="color: #303133;font-size:46rpx;"></text>
<u--input type="digit" maxlength="7" fontSize="23" v-model="cartForm.total_amount" <u--input type="digit" fontSize="23" v-model="cartForm.total_amount"
placeholder="请输入金额" border="none" placeholderStyle="color:#999;font-size:30rpx" placeholder="请输入金额" border="none" placeholderStyle="color:#999;font-size:30rpx"
@input="validateDecimal"> @input="validateDecimal">
</u--input> </u--input>
@ -121,8 +121,10 @@
}, },
methods: { methods: {
validateDecimal(event) { validateDecimal(event) {
console.log(event); let val = (this.cartForm.total_amount.match(/^\d*(\.?\d{0,2})/g)[0]) || ''
this.checkForm.total_amount = event.match(/^\d*(\.?\d{0,2})/g)[0] this.$nextTick(() => {
this.cartForm.total_amount = val;
})
}, },
leftClick(e) { leftClick(e) {