vue如何获取thymeleaf渲染的input值?
写项目时前端用了vue+模板引擎用了thymeleaf,然后有一个输入框取值问题让我很纠结,问题如下:
<input class="count-num" type="text" th:value="${entry.value.count}"
@change="updateCartItemCount(${entry.key})"/>
我想在@change方法中获取thymeleaf th:each循环遍历的值,解决是如下:
<input class="count-num" type="text" th:value="${entry.value.count}"
th:@change="|updateCartItemCount(${entry.key})|"/>
thymeleaf获取input输入框输入后的值:
updateCartItemCount(bookId){
// 获取bookId
console.log(bookId)
// 获取修改后的数量值
console.log(event.target.value)
}