amis/docs/zh-CN/components/form/hidden.md

39 lines
805 B
Markdown
Raw Normal View History

2020-07-28 10:03:53 +08:00
---
title: Hidden 隐藏字段
2020-07-29 16:20:21 +08:00
description:
2020-07-28 10:03:53 +08:00
type: 0
group: null
menuName: Hidden 隐藏字段
2020-07-29 16:20:21 +08:00
icon:
2020-07-28 10:03:53 +08:00
order: 26
---
## 基本用法
默认表单提交,在没有 [自定义 API 请求数据](../../../docs/types/api#%E9%85%8D%E7%BD%AE%E8%AF%B7%E6%B1%82%E6%95%B0%E6%8D%AE) 的情况下,只会发送 `body` 里面的这些成员,对于隐藏的字段同时又希望提交表单的时候带过去,可以使用 `hidden` 组件
2020-07-28 10:03:53 +08:00
```schema: scope="body"
2020-07-28 10:03:53 +08:00
{
"type": "form",
"api": "/api/mock2/form/saveForm",
2020-07-28 10:03:53 +08:00
"debug": true,
"body": [
2020-07-28 10:03:53 +08:00
{
"type": "hidden",
"name": "id",
"value": 1
},
{
"type": "input-text",
2020-07-28 10:03:53 +08:00
"name": "name",
"label": "姓名:"
},
{
"name": "email",
"type": "input-email",
2020-07-28 10:03:53 +08:00
"label": "邮箱:"
}
]
}
```