fix(接口测试): 断言数字类型修复

This commit is contained in:
baiqi 2024-11-21 14:34:34 +08:00 committed by Craftsman
parent be206f300c
commit 25952d43a5
1 changed files with 3 additions and 1 deletions

View File

@ -197,7 +197,7 @@
const expressionFormRef = ref<FormInstance | null>(null); const expressionFormRef = ref<FormInstance | null>(null);
const parseJson = ref<string | Record<string, any>>({}); const parseJson = ref<string | Record<string, any>>({});
const isHtml = ref(false); const isHtml = ref(false);
const matchResult = ref<any[]>([]); // const matchResult = ref<any[] | string>([]); //
const isMatched = ref(false); // const isMatched = ref(false); //
watch( watch(
@ -298,6 +298,8 @@
} else if (typeof results === 'object' && results !== null) { } else if (typeof results === 'object' && results !== null) {
traverseJSONObject(results); traverseJSONObject(results);
matchResult.value = results; matchResult.value = results;
} else if (typeof results === 'string' && results.includes('Number(')) {
matchResult.value = results.replace(/Number\(([^)]+)\)/g, '$1');
} else { } else {
matchResult.value = results === null || results === false ? `${results}` : results || []; matchResult.value = results === null || results === false ? `${results}` : results || [];
} }