上图是我打印出来的表单数据,但是
后端需要的格式是下面的,所有的property_detail_code_数字,property_detail_name_数字,以数字对应包到
detail里面。
[
{
"id":1,
"property_detail_code":"202",
"property_detail_name":"红色"
},
{
"id":2,
"property_detail_code":"201",
"property_detail_name":"蓝色"
},
{
"id":3,
"property_detail_code":"201",
"property_detail_name":"蓝色"
}
]
如何把提交的数据弄出来然后赋到detail参数里?
假设你的表单数据放在一个page的变量中, page.keys不就是对应的details的id吗?
这个details应该就是你需要,看看是否能满足你的需求,我的代码是手写的,没有调试,不过应该跑的过。试一试