首页 新闻 会员 周边 捐助

springboot项目中测试ztree树时,ztreeTest1:66 Uncaught ReferenceError: Ztreetest is not defined,

0
悬赏园豆:5 [待解决问题]

后端相关代码

@RequestMapping("/ztreeTest1")
public String ztreeTest1(Model model,HttpServletRequest request) throws JsonProcessingException {
List<Ztreetest> nodes=ztreetestService.findall();
model.addAttribute("nodes",nodes);
return"ztreetest1";
}

前端代码:

var list = [[${nodes}]];
var zNodes= eval(list);
$(function () {
$.fn.zTree.init($("#treeTest"), setting, zNodes);
});

然后再前端可以出现错误
ztreeTest1:66 Uncaught ReferenceError: Ztreetest is not defined,

var list = [Ztreetest(id=1, pid=0, name=电视机, open=false, checked=false), Ztreetest(id=2, pid=1, name=超薄电视, open=false, checked=false), Ztreetest(id=3, pid=1, name=全屏电视, open=false, checked=false), Ztreetest(id=4, pid=1, name=高清电视, open=false, checked=false), Ztreetest(id=5, pid=0, name=空调, open=false, checked=false), Ztreetest(id=6, pid=5, name=空调挂机, open=false, checked=false), Ztreetest(id=7, pid=5, name=空调柜式, open=false, checked=false)];

希望大神指点

flashtown的主页 flashtown | 初学一级 | 园豆:197
提问于:2020-07-29 14:36
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册