<el-input
type="textarea"
:rows="8"
maxlength="200"
show-word-limit
:placeholder="isSubmitButton ? '请输入关键词' : '暂无'"
v-model="responseForm.response"
@blur="responseBlur"
:disabled="!(isSubmitButton && responseForm.state == 0)"
v-cloak
></el-input>
methods: {
responseBlur() {
this.responseForm.response = this.responseForm.response.trim()
}
}
1、使用v-model.trim="绑定元素",会去掉所有空格,在输入时空格就无法输入;
2、使用blur方法让它再提交时候去掉空格即可;