mirror of
https://gitee.com/bootx/dax-pay-h5
synced 2026-08-13 07:45:42 +08:00
fix(h5/code-pay): 金额输入零值死锁预防,拦截0.00等零值填满小数位
This commit is contained in:
@@ -164,6 +164,13 @@ export function useCodePayPage(options: UseCodePayPageOptions) {
|
||||
else {
|
||||
current += k
|
||||
}
|
||||
// 防止零值死锁: 结果金额为零且小数位满2位(如"0.00"), 拦截
|
||||
if (Number(current) === 0) {
|
||||
const zeroDot = current.indexOf('.')
|
||||
if (zeroDot >= 0 && current.length - zeroDot > 2) {
|
||||
return
|
||||
}
|
||||
}
|
||||
// 上限:对齐后端 amount @Max(9999999999 分),超限则忽略本次按键
|
||||
if (isAmountOverMax(current)) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user