fix: 非必填字段预览显示 null
- 预览示例数据中,非必填字段显示 null 值 - 保持与实际生成逻辑一致
This commit is contained in:
@@ -64,6 +64,11 @@ export default function DataPreview({ fields }: DataPreviewProps) {
|
||||
|
||||
const record: Record<string, unknown> = {};
|
||||
for (const field of fields) {
|
||||
// 非必填字段预览显示 null
|
||||
if (!field.required) {
|
||||
record[field.name] = null;
|
||||
continue;
|
||||
}
|
||||
const generator = getGeneratorById(field.generatorId);
|
||||
if (generator) {
|
||||
record[field.name] = generator.generate(field.params);
|
||||
|
||||
Reference in New Issue
Block a user