
layui table中显示图片的方法:
图片需要用到模板.templet:
注意div不可省略,48px指的是div的高度,如果要决定img图片的高度,需要单独设计style
CMSCN 企业自助建站引擎(以下简称 CMSCN )旨在打造一款免费、高效、友好、稳定的企业自助建站引擎,降低企业建站门槛,加速中国企业信息化进程CMSCN 1.0 正式版 功能更新1. 修正v1.0 Beta版本内页导航栏焦点不正常的BUG2. 修正v1.0 Beta版本首页图片展示列表显示不正常的BUG3. 修正v1.0 Beta版本缩略图上传和幻灯图片上传jpg格式不正常的BUG4. 修正
1
<script type="text/javascript">
layui.use('table',function () {
var table= layui.table;
table.render({
elem:'#needstable'
,url:'{:url()}'
,method:'post'
,cellMinWidth:80
,page:true
,cols:[[
{field:'needs_id',title:'id',fixed:'left',width:80}
,{field:'wx_username',title:'昵称',fixed:'left',width:80}
,{field:'wx_headimg',title:'头像',fixed:'left',templet:'<div>@@##@@</div>',style:'height:48px;width:48px;line-height:48px!important;'}css,注意替换headimg
<style type="text/css">.layui-table-fixed-r td{height:58px!important;}
.layui-table-fixed-r th{height:58px!important;}
.layui-table img {
max-width: 48px;min-height: 48px;
}
.laytable-cell-3-wx_headimg ,.laytable-cell-1-wx_headimg,.laytable-cell-2-wx_headimg,.laytable-cell-3-wx_headimg,.laytable-cell-4-wx_headimg,.laytable-cell-5-wx_headimg,.laytable-cell-6-wx_headimg,.laytable-cell-7-wx_headimg,.laytable-cell-8-wx_headimg,.laytable-cell-9-wx_headimg,.laytable-cell-10-wx_headimg,.laytable-cell-11-wx_headimg,.laytable-cell-12-wx_headimg,.laytable-cell-13-wx_headimg,.laytable-cell-14-wx_headimg{
width: 48px!important;;padding:0px!important;height: 48px!important;;
line-height: 48px!important;;
}
</style>推荐:layui框架教程
以上就是layui怎么做图片在列表中显示的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号