vue 设置文本框只能输入正整数
[size=medium][color=green][b]// 验证只能输入正整数handleInput() {this.form.subjectId = this.form.subjectId.replace(/[^\.\d]/g, '')this.form.subjectId = this.form.subjectId.replace('.', '')}...
·
[size=medium][color=green][b]<el-input @keyup.native="handleInput" v-model="form.subjectId" :placeholder="$t('biomaterial.common.phprefix')+$t('subject.subjectId')"></el-input>
// 验证只能输入正整数
handleInput() {
this.form.subjectId = this.form.subjectId.replace(/[^\.\d]/g, '')
this.form.subjectId = this.form.subjectId.replace('.', '')
}
[/b][/color][/size]
// 验证只能输入正整数
handleInput() {
this.form.subjectId = this.form.subjectId.replace(/[^\.\d]/g, '')
this.form.subjectId = this.form.subjectId.replace('.', '')
}
[/b][/color][/size]
更多推荐
已为社区贡献5条内容
所有评论(0)