Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vu3版本,form表单中只有一个单行文本输入字段时,回车后页面会刷新 #150

Closed
DWL716 opened this issue Jan 21, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@DWL716
Copy link

DWL716 commented Jan 21, 2022

反馈问题请先查看文档和务必提供详细的复现代码,遵循如下格式,描述不清楚的问题将会直接关闭。

vue和ui框架

vue3 、form原生表单默认事件

问题描述

只有一个单行文本输入字段时,回车后页面会刷新

如何复现

例如 jsonschema 是这种的 只有一个属性,这样ui只会渲染一个input输入框,然后将input框进行输入状态再回车页面就会刷新,并且url上面会多一个 ?符号
"properties": {
"telephone": {
"type": "string",
"title": "Telephone"
}
}

期望的结果

....

@DWL716
Copy link
Author

DWL716 commented Jan 21, 2022

一些解决方案 https://stackoverflow.com/questions/1370021/why-does-forms-with-single-input-field-submit-upon-pressing-enter-key-in-input#
可以通过自定义组件,然后通过拦截jsonschema 判断有几个属性,当如果只有一个那对uischema进行修改,将只有一个属性的schema组件重新定向到自己写的ui上面

@lljj-x lljj-x added the enhancement New feature or request label Feb 13, 2022
lljj-x added a commit that referenced this issue Feb 19, 2022
@lljj-x
Copy link
Owner

lljj-x commented Feb 19, 2022

新版本会默阻止submit

@lljj-x lljj-x closed this as completed Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants