From 73550fc71b123fe70efde0f06ed062e765e29086 Mon Sep 17 00:00:00 2001 From: liaoxuezhi <2betop.cn@gmail.com> Date: Wed, 12 Apr 2023 14:27:12 +0800 Subject: [PATCH] =?UTF-8?q?chore(amis-editor):=20=E4=BC=98=E5=8C=96=20inpu?= =?UTF-8?q?t-number=20=E7=9A=84=20mock=20=E9=80=BB=E8=BE=91=20(#6583)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(amis-editor): 优化 input-number 的 mock 逻辑 * chore(amis-editor): 优化 input-number 的 mock 逻辑 --- packages/amis-editor-core/src/mocker.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/amis-editor-core/src/mocker.ts b/packages/amis-editor-core/src/mocker.ts index 02648a273..26419ee97 100644 --- a/packages/amis-editor-core/src/mocker.ts +++ b/packages/amis-editor-core/src/mocker.ts @@ -17,6 +17,11 @@ export function mockValue(schema: any) { schema.type === 'input-month' ) { return moment().format('X'); + } else if (schema.type === 'number' || schema.type === 'input-number') { + const precision = schema.precision || 0; + return precision + ? (Math.random() * 10000).toFixed(precision) + : Math.random() * 10000; } else if (schema.type === 'image' || schema.type === 'static-image') { return placeholderImage; } else if (schema.type === 'images' || schema.type === 'static-images') {