ホームページ  >  記事  >  ウェブフロントエンド  >  Lauiuiで写真をリストに表示する方法

Lauiuiで写真をリストに表示する方法

尚
オリジナル
2019-07-31 15:02:135267ブラウズ

Lauiuiで写真をリストに表示する方法

layui テーブルに画像を表示する方法:

画像は template.templet を使用する必要があります:

divは省略できないので注意してください。48pxはdivの高さを指します。img画像の高さを決めたい場合は別途style

<script type="text/javascript">

    layui.use(&#39;table&#39;,function () {
        var table= layui.table;
        table.render({
            elem:&#39;#needstable&#39;
            ,url:&#39;{:url()}&#39;
            ,method:&#39;post&#39;
            ,cellMinWidth:80
            ,page:true
            ,cols:[[
                {field:&#39;needs_id&#39;,title:&#39;id&#39;,fixed:&#39;left&#39;,width:80}
                ,{field:&#39;wx_username&#39;,title:&#39;昵称&#39;,fixed:&#39;left&#39;,width:80}
                ,{field:&#39;wx_headimg&#39;,title:&#39;头像&#39;,fixed:&#39;left&#39;,templet:&#39;<div><img src="{{ d.wx_headimg}}"></div>&#39;,style:&#39;height:48px;width:48px;line-height:48px!important;&#39;}

cssを設計する必要があります。見出し

<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フレームワークチュートリアル

の置き換えに注意してください。

以上がLauiuiで写真をリストに表示する方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。