输入金额判断整数

This commit is contained in:
魏啾 2024-11-13 18:28:50 +08:00
parent 5b0b69bf97
commit 528344d6ce
1 changed files with 3 additions and 2 deletions

View File

@ -5,12 +5,13 @@
<el-form-item label="充值"> <el-form-item label="充值">
<template> <template>
<div style="display: flex;"> <div style="display: flex;">
<el-input style="width: 220px;" placeholder="请输入金额" v-model="form.amount"> <el-input style="width: 220px;" placeholder="请输入金额" v-model="form.amount"
@input="(v) => (form.amount = v.replace(/^(0+)|[^\d]+/g, ''))">
<template slot="prepend"></template> <template slot="prepend"></template>
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>
<el-input style="margin-left: 20px; width: 220px;" placeholder="请输入金额" <el-input style="margin-left: 20px; width: 220px;" placeholder="请输入金额"
v-model="form.giftAmount"> v-model="form.giftAmount" @input="(v) => (form.giftAmount = v.replace(/^(0+)|[^\d]+/g, ''))">
<template slot="prepend"></template> <template slot="prepend"></template>
<template slot="append"></template> <template slot="append"></template>
</el-input> </el-input>