添加一个 equal 的用法

This commit is contained in:
2betop 2020-02-27 18:40:19 +08:00
parent 264a66b904
commit d66801ac34
1 changed files with 11 additions and 0 deletions

View File

@ -238,6 +238,17 @@ export const filters: {
fn = value => !value;
} else if (directive === 'isExists') {
fn = value => typeof value !== 'undefined';
} else if (directive === 'equals' || directive === 'equal') {
arg1 = arg1
? /^('|")(.*)\1$/.test(arg1)
? RegExp.$2
: resolveVariable(arg1, this as any)
: '';
// 比对的值是空时直接返回。
if (!arg1) {
return input;
}
fn = value => arg1 == value;
} else {
if (directive !== 'match') {
directive = 'match';