elementui el-input-number显示空
时间: 2023-11-08 13:55:00 浏览: 199
element-ui的el-input-number组件在值传入为''(空字符串)时,默认显示为0。然而,在某些情况下,我们可能希望它显示为空而不是显示为0。对于这种情况,我们可以进行一些兼容处理来实现显示为空的效果。具体做法是在使用el-input-number组件时,在v-model后面加上.number修饰符。通过这样的修改,当值为空字符串时,el-input-number组件会将其显示为空,而不是显示为0。例如,可以使用以下代码来实现这个效果:<el-input-number v-model.number="num"></el-input-number>。<span class="em">1</span><span class="em">2</span>
#### 引用[.reference_title]
- *1* [Vue elementUI el-input值类型为number类型](https://blog.csdn.net/sunshineTing2/article/details/114299197)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [element input-number 默认值设置为空](https://download.csdn.net/download/qq_34086049/15483108)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文