filter 在处理空值时与原来不一致

This commit is contained in:
liaoxuezhi 2019-10-30 20:06:48 +08:00
parent a631fc12eb
commit 7c48f9178c
1 changed files with 10 additions and 1 deletions

View File

@ -232,7 +232,16 @@ export const filters: {
arg1 = expOrDirective;
}
arg1 = arg1 ? (/^('|")(.*)\1$/.test(arg1) ? RegExp.$2 : resolveVariable(arg1, this as any)) : '';
fn = value => !!~String(value).toLowerCase().indexOf(arg1);
// 比对的值是空时直接返回。
if (!arg1) {
return input;
}
fn = value =>
!!~String(value)
.toLowerCase()
.indexOf(arg1);
}
keys = keys.split(/\s*,\s*/);