4***@qq.com
4***@qq.com
  • 发布:2016-08-15 15:50
  • 更新:2016-08-15 15:50
  • 阅读:1452

请问有没有办法动态的生成form表单

分类:MUI

我想实现通过ajax从后台获取json数据,然后动态生成form表单,比如说json格式如下:
{
"form": [
{
"type": "checkbox",
"title": "性别",
"decs": "男|女",
"content": ""
},
{
"type": "textview",
"title": "姓名",
"decs": "请输入姓名...",
"content": ""
},
{
"type": "longtext",
"title": "个性签名",
"decs": "这家伙很懒,暂时没有写...",
"content": ""
}
]
}
当我又有个请求的json变了,成了这样:
{
"form": [
{
"type": "textview",
"title": "用户名",
"decs": "请输入...",
"content": ""
},
{
"type": "password",
"title": "密码",
"decs": "请输入...",
"content": ""
},
{
"type": "textview",
"title": "电话号码",
"decs": "",
"content": ""
},
{
"type": "textview",
"title": "家庭住址",
"decs": "",
"content": ""
},
{
"type": "longtext",
"title": "备注",
"decs": "",
"content": ""
}
]
}

2016-08-15 15:50 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复