2.5.4
win7 64位;Chrome v70.0.3538.110
2.6.5
https://jsfiddle.net/lmwdtzs/eL6k0387/1/
第一个el-input,输入数字后,无法在数字末尾输入小数点,只能在数字中间输入小数点
第二个原生input,可以正常输入小数点
el-input的v-model.number可以正常输入小数点
数字末尾无法输入小数点,只能在数字中间输入小数点,影响体验且用户一般无法发现如何输入小数点
Translation of this issue:
2.5.4
Win7 64 bits; Chrome v70.0.3538.110
2.6.5
https://jsfiddle.net/lmwdtzs/eL6k0387/1/
The first el-input, after entering the number, can not enter decimal point at the end of the number, can only enter decimal point in the middle of the number.
The second native input, which can normally enter decimal points
V-model. number of el-input can input decimal point normally
The decimal point can not be input at the end of the number, but only in the middle of the number, which affects the experience and the user generally can not find out how to input the decimal point.
[email protected]还是正常的,新版会有这个问题
我也遇到了,正准备提issue。
请不要在el-input的v-model上用修饰符(包括lazy、number、trim)
要实现功能请自行处理input事件
@wacky6 那为什么以前可以用?为什么出了问题后,文档中也没有说明?
遇到同样的问题,带有number修饰的组件,升级完之后突然发现无法输入小数点
Same issues here! Hope this will be fixed soon.
设置type="number"就可以输入了
可以使用回2.3.7版本
<el-input
v-model="postForm.minimumAmount"
name="minimumAmount"
required
placeholder="Minimum Amount"
type="number"
/>
worked for me even for decimal
@sandeshgb This technically doesn't work. It will allow you to use a decimal, but when I tried, it actually turns off/overrides element's form validation.
My workaround was to just create a custom validator (BOO).
<el-form-item
prop="insuredValue"
:rules="{
validator: numberValidation,
message: $t('errorNumber', {
subject: $t('insuredValue')
}),
trigger: 'change'
}"
><el-input
:placeholder="$t('insuredValue')"
v-model="forms.insuredValue"
>
</el-input>
</el-form-item>
numberValidation(rule, value, callback) {
if (isNaN(+value)) {
callback(new Error());
} else {
callback();
}
}
<el-input type="number" v-model.number="inputVal"></el-input>
set type && .number is OK🙆
Why cannot support v-model modifer?
在框架迁移1.x 到2.x 中 应说明情况,更新日志并没有说明这一点。
降级到较近的老版本~
Most helpful comment
set type && .number is OK🙆