标签:fun head 申请 ssi title ++ 委员会 com ret
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Dict</title>
</head>
<body>
</body>
<!--测试字典功能-->
<script>
const dictJsonStr = {
"agentType": [
{
"key": "1",
"name": "律师代理"
},
{
"key": "2",
"name": "公民代理"
}
],
"commission": [
{
"key": "123456",
"name": "广州仲裁委员会"
}
],
"litigantType": [
{
"key": "1",
"name": "申请人"
},
{
"key": "2",
"name": "被申请人"
},
{
"key": "3",
"name": "第三人"
}
]
};
function getDictName(dict, key){
childDict = dictJsonStr[dict];
for (i=0;i<childDict.length;i++){
if(childDict[i].key == key) {
return childDict[i];
}
}
}
getDictName("litigantType", 3).name;//可直接用此方法进行查询
console.log("字典",dictJsonStr,dictJsonStr["litigantType"]);
console.log("字典2",dictJsonStr,dictJsonStr.litigantType);
console.log("字典查询",getDictName("litigantType", 3).name)
</script>
</html>
标签:fun head 申请 ssi title ++ 委员会 com ret
原文地址:http://www.cnblogs.com/CrystalPeng/p/7569804.html