layui中怎么实现图片在列表中显示

这期内容当中小编将会给大家带来有关layui中怎么实现图片在列表中显示,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

layui table中显示图片的方法:

layui中怎么实现图片在列表中显示

图片需要用到模板.templet:

注意div不可省略,48px指的是div的高度,如果要决定img图片的高度,需要单独设计style

<scripttype="text/javascript">layui.use('table',function(){vartable=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><imgsrc="{{d.wx_headimg}}"></div>',style:'height:48px;width:48px;line-height:48px!important;'}

css,注意替换headimg

<styletype="text/css">.layui-table-fixed-rtd{height:58px!important;}.layui-table-fixed-rth{height:58px!important;}.layui-tableimg{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中怎么实现图片在列表中显示了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注恰卡编程网行业资讯频道。

发布于 2021-07-24 22:39:02
收藏
分享
海报
0 条评论
178
上一篇:layui中怎么回填下拉选中的值 下一篇:bootstrap中怎么实现拖动布局元素
目录

    推荐阅读

    0 条评论

    本站已关闭游客评论,请登录或者注册后再评论吧~

    忘记密码?

    图形验证码