Skip to content

Commit

Permalink
perf: RuleCard obj.rules
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Jan 2, 2025
1 parent 2c704a1 commit da8600a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/views/snapshot/RuleCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,18 @@ const dataRef = computed<RawNode | string>(() => {
}
return checkRule(rule as ResolvedData);
}
if (obj.rules) {
const rules = Array.isArray(obj.rules) ? obj.rules : [obj.rules];
if (rules.length !== 1) {
return '非法格式: rules 长度不为 1';
}
const rule =
typeof rules[0] === 'string' ? { matches: rules[0] } : rules[0];
if (!isObj(rule)) {
return '非法格式: rules[0] 非法';
}
return checkRule(rule as ResolvedData);
}
return checkRule(obj as ResolvedData);
});
const errorText = computed(() => {
Expand Down

0 comments on commit da8600a

Please sign in to comment.