方法:把空格通过正则匹配替换为空字符串
// this.inputValue——input输入值
//----判断是否为空或者空格---
if (this.inputValue.replace(/(^\s*)|(\s*$)/g, "") == "") {
console.log('未输入或者输入为空格')
} else {
console.log('输入:', this.inputValue)
};
方法:把空格通过正则匹配替换为空字符串
// this.inputValue——input输入值
//----判断是否为空或者空格---
if (this.inputValue.replace(/(^\s*)|(\s*$)/g, "") == "") {
console.log('未输入或者输入为空格')
} else {
console.log('输入:', this.inputValue)
};