Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: When the input box's type is set to number, the result is forcibly converted to the number type. #1425

shuai92de2ef16f02
diff --git a/ui/src/components/SchemaForm/components/Input.tsx b/ui/src/components/SchemaForm/components/Input.tsx
index d84d7d55..a1838151 100644
--- a/ui/src/components/SchemaForm/components/Input.tsx
+++ b/ui/src/components/SchemaForm/components/Input.tsx
@@ -64,7 +64,7 @@ const Index: FC<Props> = ({
...formData,
[name]: {
...formData[name],
- value,
+ value: type === 'number' ? Number(value) : value,
isInvalid: false,
},
};
diff --git a/ui/src/pages/Admin/Smtp/index.tsx b/ui/src/pages/Admin/Smtp/index.tsx
index cde274e3..85a1b976 100644
--- a/ui/src/pages/Admin/Smtp/index.tsx
+++ b/ui/src/pages/Admin/Smtp/index.tsx
@@ -59,7 +59,7 @@ const Smtp: FC = () => {
enumNames: ['TLS', 'SSL', 'None'],
},
smtp_port: {
- type: 'string',
+ type: 'number',
title: t('smtp_port.label'),
description: t('smtp_port.text'),
},
@@ -160,7 +160,7 @@ const Smtp: FC = () => {
from_name: formData.from_name.value,
smtp_host: formData.smtp_host.value,
encryption: formData.encryption.value,
- smtp_port: Number(formData.smtp_port.value),
+ smtp_port: formData.smtp_port.value,
smtp_authentication: formData.smtp_authentication.value,
...(formData.smtp_authentication.value
? { smtp_username: formData.smtp_username.value }