layui中使用dtree插件数据无法正常显示
layui中使用dtree插件数据无法正常显示
检查自己返回的josn数据格式和dtree需要的数据是否相同
示例格式:
{
"code":0,
"msg":"操作成功",
"data":[
{"id":"001","title": "湖南省", "spread":true, "parentId": "0","checkArr": "{\"type\": \"0\", \"checked\": \"0\"}"},
{"id":"002","title": "湖北省","spread":false, "parentId": "0","checkArr": "{\"type\": \"0\", \"checked\": \"0\"}"},
{"id":"001001", "title": "长沙市", "parentId": "001","checkArr": "{\"type\": \"0\", \"checked\": \"0\"}"},
{"id":"001002", "title": "株洲市", "parentId": "001" ,"checkArr": "{\"type\": \"0\", \"checked\": \"0\"}"},
{"id":"001003", "title": "湘潭市", "parentId": "001" ,"checkArr": "{\"type\": \"0\", \"checked\": \"0\"}"},
{"id":"001004","title": "衡阳市", "parentId": "001","checkArr": "{\"type\": \"0\", \"checked\": \"0\"}"},
{"id":"001005","title": "郴州市","parentId": "001","checkArr": "{\"type\": \"0\", \"checked\": \"0\"}"},
{"id":"002001","title": "武汉市","parentId": "002","checkArr": "{\"type\": \"0\", \"checked\": \"0\"}"},
{"id":"002002","title": "黄冈市","parentId": "002","checkArr": "{\"type\": \"0\", \"checked\": \"0\"}"},
{"id":"002003","title": "荆州市","parentId": "002","checkArr": "{\"type\": \"0\", \"checked\": \"0\"}"},
{"id":"002004","title": "天门市","parentId": "002","checkArr": "{\"type\": \"0\", \"checked\": \"0\"}"},
{"id":"002005","title": "孝感市","parentId": "002","checkArr": "{\"type\": \"0\", \"checked\": \"0\"}"}
]
}
我的数据格式
@JsonProperty(value = "parentId")
private Integer pid;
private String title;
private String icon;
private String href;
private String target;
private Boolean spread;
public String getCheckArr() {
return checkArr;
layui中使用dtree插件数据无法正常显示相关教程