我有选择框,取决于我需要显示数组项的选定选项
静态地我有一个数组,取决于我根据我的要求建立反应形式的选择静态数组,如
form_objects = [
{
"id":1,
"legend":"businessModule",
"group":[
{
"id":1,
"permission":{
"controleType":"ff",
"id":2,
"key":"create Business",
"legend":"businessModule",
"label": "create Business"
},
"roles":[
{
"id":1,
"name":"self"
},
{
"id":2,
"name":"other"
}
]
},
{
"id":1,
"permission":{
"controleType":"ff",
"id":2,
"legend":"businessModule",
"key":"edit business",
"label": "edit business"
},
"roles":[
{
"id":1,
"name":"self"
},
{
"id":2,
"name":"other"
}
]
}
]
},
{
"id":2,
"legend":"PanicModule",
"group":[
{
"id":1,
"permission":{
"controleType":"ff",
"id":2,
"legend":"PanicModule",
"key":"create panic",
"label": "create panic"
},
"roles":[
{
"id":1,
"name":"self"
},
{
"id":2,
"name":"other"
}
]
},
{
"id":1,
"permission":{
"controleType":"ff",
"id":2,
"legend":"PanicModule",
"key":"edit panic",
"label": "edit panic"
},
"roles":[
{
"id":1,
"name":"self"
},
{
"id":2,
"name":"other"
}
]
}
]
}
我想像这样建立一个可重复的数组
{
"roleName":"",
"roleDescription":"",
"permissionModules":"PanicModule",
"permission":[
{
"id":2,
"key":"create Business",
"legend":"businessModule",
"ischecked":null,
"label":"create Business",
"roles":[
{
"id":1,
"name":"self"
},
{
"id":2,
"name":"other"
}
]
},
{
"id":2,
"key":"edit business",
"legend":"businessModule",
"ischecked":null,
"label":"edit business",
"roles":[
{
"id":1,
"name":"self"
},
{
"id":2,
"name":"other"
}
]
}
]
}
我的要求是,当我选择业务模块时,我需要显示业务权限和角色,如果我选择Pnic Modle,我需要显示恐慌角色和 权限,
我想用反应形式构建它,所以我试着这样做 https://plnkr.co/edit/OZGEWDEa0UzMXFO6lreG?p=preview
我不知道这是不是好方法,Pleace帮助我, 提前致谢