今天做一个关于模糊查询的
这种形式的 用户在某个input框输入就向后台传某个参数, 但是发现值为""的字段也会被传过去 导致查询失败
于是需要过滤掉form表单内的空值
以下方法可实现
for (const key in this.searchForm) {
// 去除对象内多余的空值key
if (this.searchForm[key] === "") {
delete this.searchForm[key]
}
}