vue.jsinputvuejs2vue-componentelement-ui

Vue Element UI Input Model Trim is not allowing space at all


I am using element UI model trim to trim value when saving.

But while doing so it is not allowing space at all while doing trim with the normal input element, it is allowing space.

Following is how I have trimmed the value in the element UI input.

<el-input v-model.trim="input"></el-input>

Same when I use normal input, it is allowing to enter space.

<input v-model.trim="input" />

How do I manage to allow space as user cannot be restricted to not allow space between characters?

Following is the code sandbox link where normal input works as expected but element UI input is not allowing space at all.

https://codesandbox.io/s/hopeful-silence-s4hwr2?file=/src/components/index.vue:23-65


Solution

  • Seems to be open bug in element UI, but still open to better answer if anyone has any solution to this.

    https://github.com/ElemeFE/element/issues/19165