thymeleaf中onclick方法传值

在springboot2.3.0中,发现下面这种方式不能正常传值:

<button class="btn btn-primary" th:onclick="'pay('+${order.orderId}+')'">支付</button>

改为使用下面的方式后,正常传值:

<button class="btn btn-primary" th:onclick="pay([[${order.orderId}]])">支付</button>

猜你喜欢

转载自blog.csdn.net/qq_41120971/article/details/107502880