Skip to content

详情页的显示和扩展

字段显示

图片

php
$show->field('picture')->image();

//设置服务器和宽高
$show->field('picture')->image('http://xxx.com', 100, 100);

// 显示多图
$show->field('pictures')->display(function ($pictures) {

    return json_decode($pictures, true);

})->image('http://xxx.com', 100, 100);

显示 label 标签

php
$show->field('name')->label();

显示 badge 标签

php
$show->field('name')->badge();

布尔值显示 (bool)

php
$show->field('approved')->bool();

列展开 (expand)

php
$show->field("text", "text")->display(function (){
            return "查看";
        })->expand(function (){
            $header = ["参数","值"];
            $data = [
                ["参数1","值1"],
                ["参数2","值2"],
                ["参数3","值3"],
            ];
            return new Table($header,$data);
        });

弹出模态框 (modal)

php
$show->field("text", "text")->modal(function (){
            return "查看";
        });

进度条 (progressBar)

php
$table->rate->progressBar();

字符串或数组截取 (limit)

php
// 最多显示50个字符
$show->field('content')->limit(50, '...');

// 如果字段值是数组也支持
$table->tags->limit(3);

列二维码 (qrcode)

php
$show->field('content')->qrcode();

可复制 (copyable)

php
$show->field('content')->copyable();
php
// link方法不传参数时,链接的`href`和`text`都是当前列的值
$show->field('homepage')->link();