后台Controller:
@HtmlTitle(title = "Statistic")
@RequestMapping("/statistic")
public String statistic(Model model){
List<SGo> sGos = sGoRepository.findAll();
model.addAttribute("sGos",sGos);
return "statistic/index-statistic";
}
js代码:
<script th:inline="javascript">
var GoEggNogNum = [[${sGos.get(0).nums}]];
var GoNum = [[${sGos.get(1).nums}]];
</script>