baidu / baidu/amis

回车后表单提交事件不执行

Open
#11,635 6 comments 0 reactions 0 assignees View on GitHub
feat need confirm
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

#### 描述问题:

Form 表单设置了回车提交,回车input 不会执行表单提交,点击提交按钮会执行

#### 截图或视频:

![Image](https://github.com/user-attachments/assets/8f5f047b-a689-46e8-ace4-5e895f018343)

#### 如何复现(请务必完整填写下面内容):

1. 你是如何使用 amis 的?
`sdk`、`npm` 或`其他`...

npm

2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
"amis": "6.11.0",
"amis-core": "6.11.0",
"amis-editor": "6.11.0",
"amis-editor-core": "6.11.0",
"amis-formula": "6.11.0",
"amis-widget": "^3.2.2",

3. 粘贴有问题的完整 `amis schema` 代码:
{
"type": "form",
"id": "u:4cb7093c2e45",
"title": "表单",
"mode": "flex",
"labelAlign": "top",
"dsType": "api",
"feat": "Insert",
"body": [
{
"type": "input-text",
"label": "文本",
"name": "text",
"row": 0,
"id": "u:262ed3ccab80"
}
],
"actions": [
{
"type": "button",
"label": "提交",
"onEvent": {
"click": {
"actions": [
{
"actionType": "submit",
"componentId": "u:4cb7093c2e45"
}
]
}
},
"level": "primary",
"id": "u:d0e556616013"
}
],
"resetAfterSubmit": true,
"onEvent": {
"submit": {
"weight": 0,
"actions": [
{
"ignoreError": false,
"actionType": "custom",
"script": "alert(1)",
"args": {}
}
]
}
}
}

4. 操作步骤
请简单描述一下复现的操作步骤...

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the provided AMIS form schema using the listed npm 6.11.0 packages, comparing Enter in the input with clicking the submit button. Start by tracing the form submit event and keyboard handling; done means Enter triggers the same submit event and custom alert as the button.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.