Laravel-admin 模型详情显示 html 的问题 setEscape
2020-06-07 01:02 浏览(1546

$show->description('描述');

当 description 是html 内容时,html的标签会被转义;查找文档无果,查看源码找到了解决办法

vendor\encore\laravel-admin\src\Show\Field.php

/**
 * Set escape or not for this field.
 *
 * @param bool $escape
 *
 * @return $this
 */
public function setEscape($escape = true)
{
    $this->escape = $escape;

    return $this;
}

调用 setEscape 方法即可

$show->description('描述')->setEscape(false);

评论(5)
发布评论
回复X
聊天室(0