<el-form-item label="流动名称:" prop="orig">        <el-input          v-model="searchFormValues.orig"          placeholder="始发站"          class="mediaInput"          style="width: 150px;"          size="mini"          maxlength="3"          @keyup.native="trimLR('orig')"        ></el-input>      </el-form-item>
// 去所有除空格    trimLR(val) {      this.searchFormValues[val] = this.searchFormValues[val].replace(        /\s+/g,        '',      )    },

目前办法为去掉所有空格。如果须要去除其余地位的空格,更换对应正则即可
1去掉右边空格

str.replace(/^\s*/g,”“);

2去掉左边空格

str.replace(/\s*$/g,”“);

3去掉前后空格

str.replace(/(^\s)|(\s$)/g,”“);