1. 直接传值:+${fv.id}+
<button type="button" class="btn btn-danger btn-sm"
th:onclick="'javascript:deleteUser('+${fv.id}+')' ">删除</button>
效果:
<button type="button" class="btn btn-danger btn-sm" onclick="javascript:deleteUser(4536)">删除</button>
2. 字符串拼接传值 \'li_'+${fv.id}+'\'
<button type="button" class="btn btn-danger btn-sm"
th:onclick="'javascript:deleteUser(\'li_'+${fv.id}+'\')' ">thymeleaf删除</button>
效果:
<button type="button" class="btn btn-danger btn-sm" onclick="javascript:deleteUser('li_4536')">thymeleaf删除</button>
3. 字符串拼接传值 2 'li_[[${fv.id}]]'
<button type="button" class="btn btn-danger btn-sm"
th:onclick="javascript:deleteUser('li_[[${fv.id}]]')">thymeleaf删除2</button>
效果
<button type="button" class="btn btn-danger btn-sm" onclick="javascript:deleteUser('li_4536')">thymeleaf删除2</button>
4. th:onmouseover ,th:onmouseout (thymeleaf 不支持 onmouseenter,onmouseleave???)
<button type="button" class="btn btn-danger btn-sm"
th:onmouseover="$('#li_[[${fv.id}]]').hide()"
th:onmouseout="$('#li_[[${fv.id}]]').show()">hide</button>