<div th:each="answer,answerStat:${question.getAnswers()}" class="layui-col-md8 layui-col-md-offset2" style="background-color: #fff;margin-top: 20px;">
<div class="" style="font-size: 1.2em;background-color: #fff;">
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-primary">
<i class="layui-icon"></i>
</button>
<button type="button" class="layui-btn layui-btn-primary">
<i class="layui-icon"></i>
</button>
<button type="button" th:id="talk+(${answer.id})" th:onclick="show('talk',[[${answer.id}]]);" class="layui-btn layui-btn-primary">
<i class="layui-icon"></i>
</button>
</div>
<div th:id="Input+(${answer.id})" class="layui-hide layui-form" style="margin-top: 5px;">
<div class="layui-form-item">
<input type="text" class="layui-input" placeholder="输入评论" />
</div>
<div class="layui-btn-group">
<button type="button" th:id="answer+(${answer.id})" class="layui-btn layui-btn-primary">
<i class="layui-icon">提交评论</i>
</button>
</div>
</div>
</div>
window.show= function (str,id) {
id = str+id;
console.log(id);
$("div[id^=id]").removeClass("layui-hide");
}
想着可能是模板引擎加载可能是异步,但是使用th:click还是没用
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…