新增宫格导航组件;增加innermargin设置(手机滚动条间隙);增加tp模板渲染;

This commit is contained in:
2023-04-13 18:05:21 +08:00
parent d537a0fb23
commit 2ed7ee5d5a
13 changed files with 306 additions and 8 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace app\model;
use MallardDuck\HtmlFormatter\Formatter;
use Parsedown;
use ScssPhp\ScssPhp\Compiler;
use think\Env as ThinkEnv;
@@ -20,6 +21,7 @@ use think\model\concern\SoftDelete;
*/
class Post extends Model
{
use SoftDelete;
//
public static $stausNameList = [
@@ -27,8 +29,6 @@ class Post extends Model
1 => '发布'
];
use SoftDelete;
protected $defaultSoftDelete = 0;
public function category()
@@ -214,8 +214,21 @@ class Post extends Model
$env_info->load($components_path . '/_index.env');
$php_path = $components_path . '/_index.php';
$components_data = [];
if(file_exists($php_path)) {
$components_data = require($php_path);
}
$html_content = View::display(file_get_contents($components_path . '/_index.html'), $components_data);
$formatter = new Formatter();
$html_content = $formatter->beautify($html_content);
$list_components_data[$components_name]['config'] = $env_info->get();
$list_components_data[$components_name]['html'] = file_get_contents($components_path . '/_index.html');
$list_components_data[$components_name]['html'] = $html_content;
$list_components_data[$components_name]['scss'] = file_get_contents($components_path . '/_index.scss');
$list_components_data[$components_name]['css'] = $scss_compiler->compileString($list_components_data[$components_name]['scss'])->getCss();
$list_components_data[$components_name]['markdown'] = file_get_contents($components_path . '/_index.md');