feat(充值代理页): 转账数额输入框取消小数点
This commit is contained in:
parent
7dc682188b
commit
38152de7c9
@ -200,8 +200,11 @@
|
||||
v-model="rechargeAmount"
|
||||
type="number"
|
||||
min="1"
|
||||
step="1"
|
||||
:placeholder="t('enter_recharge_amount')"
|
||||
class="amount-input"
|
||||
@input="preventDecimalInput"
|
||||
@keydown="onKeyDown"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -438,6 +441,27 @@ const Confirm = () => {
|
||||
closedPopup()
|
||||
}
|
||||
|
||||
// 防止输入小数点的函数
|
||||
const preventDecimalInput = (event) => {
|
||||
// 移除小数点和其他非整数字符
|
||||
event.target.value = event.target.value.replace(/[^0-9]/g, '')
|
||||
|
||||
// 确保最小值为1
|
||||
if (event.target.value === '' || parseInt(event.target.value) < 1) {
|
||||
event.target.value = ''
|
||||
}
|
||||
|
||||
rechargeAmount.value = event.target.value
|
||||
}
|
||||
|
||||
// 键盘按下事件,阻止某些按键
|
||||
const onKeyDown = (event) => {
|
||||
// 阻止小数点、e、+、- 等特殊字符
|
||||
if (['.', 'e', '+', '-'].includes(event.key)) {
|
||||
event.preventDefault()
|
||||
}
|
||||
}
|
||||
|
||||
// 校验销售商权限
|
||||
const checkDealerAccess = async () => {
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user