Element: [Bug Report] <el-input></el-input> cannot use watch and @input to monitor blank space in real time.

Created on 21 Sep 2018  ·  4Comments  ·  Source: ElemeFE/element

Element UI version

2.4.7

OS/Browsers version

Chrome 68

Vue version

2.5.17

Reproduction Link

https://jsfiddle.net/mmx38qxw/6204/

Steps to reproduce

jsfiddle

What is Expected?


可以实现实时去空格
https://jsfiddle.net/mmx38qxw/6206/

What is actually happening?


组件的行为是,输入空格后 空格不会去除,当再次输入文本的时候,才去除空格
https://jsfiddle.net/mmx38qxw/6204/

Most helpful comment

this.$nextTick(() => {
let input = this.getInput();
input.value = this.value;
});
这段代码会导致
时 不能输入 小数点后面带0的数值。
比如 1.0 会在输入时丢失 .0 导致无法输入 1.01
https://codepen.io/sunchanglong/pen/wZqVjx

All 4 comments

image
获取不到导致undefind报错
image

this.$nextTick(() => {
let input = this.getInput();
input.value = this.value;
});
这段代码会导致
时 不能输入 小数点后面带0的数值。
比如 1.0 会在输入时丢失 .0 导致无法输入 1.01
https://codepen.io/sunchanglong/pen/wZqVjx

@sunchanglong 因为1.0 === 1. 所以你输入失败了,感觉这里不应该有number类型

v-model.trim直接失效了,空格不能输入

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yorululu picture yorululu  ·  3Comments

yuchonghua picture yuchonghua  ·  3Comments

FranzSkuffka picture FranzSkuffka  ·  3Comments

PanJiaChen picture PanJiaChen  ·  3Comments

gengxuelei picture gengxuelei  ·  3Comments