model.addAttribute("types",typeService.seleTypesByParentId(-1));//查询一级标题
前端
<html lang="en" xmlns:th="http://www.thymeleaf.org"> xmlns:color="http://www.w3.org/1999/xhtml">
<script th:inline="javascript" type="text/javascript" rel="script">
let types = [[${types}]];
</script>
</html>
注意!!!!!
<html lang="en" xmlns:th="http://www.thymeleaf.org">
th:inline="javascript"