Element: [Bug Report] input type="number" 使用中文输入法时文本框换行(光标位置偏上)

Created on 27 Jun 2019  ·  4Comments  ·  Source: ElemeFE/element

Element UI version

2.10.0

OS/Browsers version

macOS Mojave/Chrome 75.0.3770.100

Vue version

2.6.10

Reproduction Link

https://jsfiddle.net/s5cpwr0d/

Steps to reproduce

使用中文输入法输入后space或者enter

What is Expected?

文本框不会换行(光标位置正确)

What is actually happening?

文本框换行(光标位置在上)

应该是行高样式问题导致的,目前这样解决了:

.el-input__inner[type="number"] {

line-height: inherit;

}

next major candidate stale

Most helpful comment

目前使用了line-height: 1解决了这个问题

All 4 comments

We will fix this issue in next major candidate.

@GODSEULGI I tried your solution, but it's not worked for me. I fixed it by this way:
```js
document.querySelector('#app').addEventListener('input', (e) => {
const target = e.target
if (target.className.indexOf('el-input__inner') > -1 && target.type === 'number' && e.data === '' && target.value === '') {
target.value = 0
target.value = ''
}
})
````

目前使用了line-height: 1解决了这个问题

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings