1.创建全局js文件 el-components.js
import Vue from 'vue'
import ElementUI from 'element-ui';
Vue.component('el-input', {
extends: ElementUI.Input,
created() {
this.$on('change', (value) => {
this.$emit('input', value.replace(/\s+/g,""))
})
}
})
2.在main.js引入
//全局去掉input框的空格
import “@/utils/el-components.js”