图片需要用到模板.templet:
注意div不可省略,48px指的是div的高度,如果要决定img图片的高度,需要单独设计style
<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><img src="/UploadFiles/2021-04-02/{{ d.wx_headimg}}">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的table中显示图片方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
最新资源
- 蔡琴《机遇》1:1母盘直刻日本头版[WAV分轨][1.1
- 陈百强《与你几分钟的约会》XRCD+SHMCD限量编号
- 陈洁丽《监听王NO.1 》示范级发烧天碟[WAV+分轨
- 单色凌.2014-小岁月太着急【海蝶】【WAV+CUE】
- 陈淑桦.1988-抱紧我HOLD.ME.NOW【EMI百代】【WA
- 黄妃.2020-色違【米乐士娱乐】【FLAC分轨】
- LouisHayes-ArtformRevisited(2024)[24Bit-96kH
- 永恒英文金曲精选5《TheBestOfEverlastingFavou
- 黑鸭子2005-紫丁香[首版][WAV+CUE]
- 林忆莲《爱上一个不回家的人》XRCD版[低速原抓W