2020-12-28 10:56:21 +08:00
|
|
|
|
---
|
|
|
|
|
title: UUID 字段
|
|
|
|
|
description:
|
|
|
|
|
type: 0
|
|
|
|
|
group: null
|
|
|
|
|
menuName: UUID 字段
|
|
|
|
|
icon:
|
|
|
|
|
order: 30
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## 基本用法
|
|
|
|
|
|
|
|
|
|
随机生成一个 id,可以用于防止表单重复提交。
|
|
|
|
|
|
2021-01-07 23:35:03 +08:00
|
|
|
|
```schema: scope="body"
|
2020-12-28 10:56:21 +08:00
|
|
|
|
{
|
|
|
|
|
"type": "form",
|
2021-08-09 18:05:01 +08:00
|
|
|
|
"api": "/api/mock2/form/saveForm",
|
2020-12-28 10:56:21 +08:00
|
|
|
|
"debug": true,
|
2021-06-07 10:09:55 +08:00
|
|
|
|
"body": [
|
2020-12-28 10:56:21 +08:00
|
|
|
|
{
|
|
|
|
|
"type": "uuid",
|
|
|
|
|
"name": "uuid"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
这个字段是不显示的,上面这个例子之所以显示是因为加了 `debug: true`。
|
2021-01-07 23:23:37 +08:00
|
|
|
|
|
|
|
|
|
## length
|
|
|
|
|
|
|
|
|
|
目前 uuid 的唯一可设置参数是 length,用于生成短随机数
|
|
|
|
|
|
|
|
|
|
```schema:height="200" scope="body"
|
|
|
|
|
{
|
|
|
|
|
"type": "form",
|
2021-08-09 18:05:01 +08:00
|
|
|
|
"api": "/api/mock2/form/saveForm",
|
2021-01-07 23:23:37 +08:00
|
|
|
|
"debug": true,
|
2021-06-07 10:09:55 +08:00
|
|
|
|
"body": [
|
2021-01-07 23:23:37 +08:00
|
|
|
|
{
|
|
|
|
|
"type": "uuid",
|
|
|
|
|
"name": "uuid",
|
|
|
|
|
"length": 8
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|