A typical case is HTML attributes for event handlers (e.g. "onload"), in which textual data from va

thymeleaf th:onclike 传入多个字符串

  • 原代码
th:οnclick="'javascript:searchHot(\''+${hot.name}+'\')'"
  • 此问题并不是错误,而是springboot版本的原因,新版本(2.xxx版本)中用用着办法是会报错的,老版本(我试的是1.3版本)用这个方法可行的。
  • 解决办法
th:onclick="searchHot([[${hot.name}]]);"

猜你喜欢

转载自blog.csdn.net/JISOOLUO/article/details/104831484