table{ table-layout:fixed;/* 只有定义了表格的布局算法为fixed,下面td的定义才能起作用。 */ } td{ height: 30px; word-break:keep-all;/* 不换行 */ white-space:nowrap;/* 不换行 */ overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */ text-overflow:ellipsis;/* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用。*/ }
<div class="layui-form-item"> <table class="layui-table" style="width: 100%"> <thead> <tr> <th>冻结金额批次号</th> <th>冻结金额</th> <th>扣款金额</th> <th>扣款状态</th> <th>备注</th> <th>操作</th> </tr> </thead> <!--内容容器--> <tbody id="con"></tbody> </table> </div>
<script type="text/html" id="conTemp"> {{# layui.each(d.list, function(index, item){ }} <tr> <td>{{item.freezeBatchSn}}</td> <td>{{item.batchFreezeAmounts}}</td> <td>{{item.deductionAmounts}}</td> <td> {{# if(item.isCancel == true){ }} 已扣款 {{# } }} {{# if(item.isCancel == false){ }} 未扣款 {{# } }} </td> <td><div style="display:block; text-align: left; width:30em;height: 30px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" title='{{item.memo}}'>{{item.memo}}</div></td> <td> {{# if(item.isCancel == true){ }} {{# } }} {{# if(item.isCancel == false){ }} <a href="javascript:;" onclick="recharge('{{item.distributorId}}')" class="btn btn--warning">释放冻结金额</a> {{# } }} </td> </tr> {{# }); }} </script>