描述问题:
InputKV 键值对,value值已经自定义为input-number类型,从表单上http发出去的还是字符串
如何复现(请务必完整填写下面内容):
- 你是如何使用 amis 的?
sdk
、npm
或其他
... - amis 版本是什么?请先在最新 beta 版本测试问题是否存在
最新 - 粘贴有问题的完整
amis schema
代码:
{
"draggable": True,
"type": "input-kv",
"label": "兑换奖品",
"name": "rewards666",
"id": "u:8cfc8df288e5",
"multiple": True,
"items": [
{
"placeholder": "Key",
"type": "input-text",
"unique": True,
"name": "key",
"required": True,
"validateOnChange": True
},
{
"placeholder": "Value",
"type": "input-number",
"name": "value"
}
],
"size": "md",
"valueType": "input-number",
"validateApi": ""
},
2条答案
按热度按时间smdncfj31#
可以帖一下完整 form 的 schema 吗?
b5buobof2#
可以帖一下完整 form 的 schema 吗?
{
"type": "page",
"title": "生成兑换码",
"body": [
{
"type": "form",
"title": "兑换码:",
"body": [
{
"label": "兑换码",
"type": "input-text",
"name": "code",
"id": "u:2ba236252247"
},
{
"draggable": true,
"type": "input-kv",
"label": "兑换奖品",
"name": "rewards666",
"id": "u:8cfc8df288e5",
"multiple": true,
"items": [
{
"placeholder": "Key",
"type": "input-text",
"unique": true,
"name": "key",
"required": true,
"validateOnChange": true
},
{
"placeholder": "Value",
"type": "input-number",
"name": "value"
}
],
"size": "md",
"valueType": "input-number",
"validateApi": ""
},
{
"type": "input-number",
"label": "过期时间(天)",
"name": "expire_time",
"keyboard": true,
"id": "u:fe9230709e2c",
"step": 1,
"required": true,
"size": "xs",
"min": 0,
"max": 365,
"value": 3
}
],
"id": "u:f2c27a03d240",
"submitText": "生成",
"api": {
"url": "http://localhost:31203/house/game/internal/code/generateredeemcode",
"method": "post",
"messages": {
"success": "生成成功",
"failed": "生成失败"
},
"dataType": "json",
"headers": {
"Content-Type": "application/json",
"meta-msgid": 0
},
"data": {
"rewards": "{${reward_key}:${reward_value}}",
"code": "${code}",
"expire_time": "${expire_time}",
"&": "$$"
},
"requestAdaptor": "return {\r\n ...api,\r\n data: {\r\n ...api.data, // 获取暴露的 api 中的 data 变量\r\n // foo: 'bar' // 新添加数据\r\n }\r\n};",
"adaptor": "return {\r\n ...payload,\r\n status: payload.code === 200 ? 0 : payload.code\r\n};\r\n"
},
"mode": "horizontal",
"onEvent": {
"submit": {
"weight": 0,
"actions": [
]
}
}
}
],
"id": "u:2a5ff5792b5c",
"pullRefresh": {
"disabled": true
},
"regions": [
"body",
"header"
]
}