thymeleaf SpringEl 生成引号

来源:互联网 发布:坑爹哥的淘宝店 编辑:程序博客网 时间:2024/06/05 16:22
由于需要些前端页面验证功能,前端采用了themeleaf,因而会用到SpringEL。其中个小个地方浪费了及时分钟才搞掂
转化出引号正确的方法

<button th:if="${openid}" th:onclick="${'clear_user_score('''+openid+''')'}">清除此用户的分数,以及排行榜</button>

这样用浏览器f12查看会生成<button onclick="clear_user_score('oSSKNwAHTIYrx99k42ZTXwzl_Z5o')">清除此用户的分数,以及排行榜</button>  这是正确的


0 0
原创粉丝点击