如何将对象传递给百里香的onclick方法

时间:2017-07-30 22:47:15

标签: javascript spring-boot thymeleaf

我正在尝试为百里香的元素添加一个onclick函数,这是我的代码:

<a th:each="item: ${unStableCaseList}" class="dropdown-item" href="#" th:text="${item.category}" th:onclick="|switchTable('${unStableCaseList}')|"></a>

它可以工作,但是传递给函数${unStableCaseList}的对象switchTable不是&#34;对象&#34;而不是普通的字符串。

无论如何都要在函数内传递一个对象?

我知道如果在html页面内创建如下所示的javascript块,它将起作用              var tmp = [[$ {unStableCaseList}]]

但是我想将函数switchTable保留在html页面之外,所以我知道如何实现它?

BR,

0 个答案:

没有答案