amis InputKV 键值对,value值已经自定义为input-number类型,从表单上http发出去,后端接收到的value还是字符串

mhd8tkvw  于 4个月前  发布在  其他
关注(0)|答案(2)|浏览(104)
描述问题:

InputKV 键值对,value值已经自定义为input-number类型,从表单上http发出去的还是字符串

如何复现(请务必完整填写下面内容):
  1. 你是如何使用 amis 的?
    sdknpm其他 ...
  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
    最新
  3. 粘贴有问题的完整 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": ""
    },
smdncfj3

smdncfj31#

可以帖一下完整 form 的 schema 吗?

b5buobof

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"
]
}

相关问题