ovidiupop / yii2-adminlte-asset
为Yii 2.0框架提供的AdminLTE后端主题资产包
dev-main
2023-12-11 17:00 UTC
Requires
- almasaeed2010/adminlte: ^3.0.2
- yiisoft/yii2: 2.*
- yiisoft/yii2-bootstrap4: ~2.0.8
This package is auto-updated.
Last update: 2024-09-11 19:04:38 UTC
README
基于AdminLTE的Yii2框架后端UI
安装
composer require ovidiupop/yii2-adminlte-asset "^2.1"
'components' => [ 'view' => [ 'theme' => [ 'pathMap' => [ '@app/views' => '@vendor/ovidiupop/yii2-adminlte-asset/example-views/yiisoft/yii2-app' ], ], ], ],
插件
use yii\web\AssetBundle; class AdminLtePluginAsset extends AssetBundle { public $sourcePath = '@vendor/almasaeed2010/adminlte/plugins'; public $css = [ 'chart.js/Chart.min.css', // more plugin CSS here ]; public $js = [ 'chart.js/Chart.bundle.min.js' // more plugin Js here ]; public $depends = [ 'ovidiupop\adminlte\web\AdminLteAsset', ]; }
由于此资产依赖于我们的AdminLteAsset
,因此您只需注册此资产,例如在您的main.php
布局文件中。
自定义内容头部
如果您想使用AdminLTE的头部的原生DOM
<h1> About <small>static page</small> </h1>
那么您可以遵循以下代码
/* @var yii\web\View $this */ $this->params['breadcrumbs'][] = 'About'; $this->beginBlock('content-header'); ?> About <small>static page</small> <?php $this->endBlock(); ?> <div class="site-about"> <p> This is the About page. You may modify the following file to customize its content: </p> <code><?= __FILE__ ?></code> </div>
左侧边栏菜单 - Widget菜单
如果您需要将菜单的各个部分分开,只需将header
选项添加到items
中的项即可
'items' => [ ['label' => 'Gii', 'iconType' => 'far' 'icon' => 'file-code', 'url' => ['/gii']], ['label' => 'Debug', 'icon' => 'dashboard-alt', 'url' => ['/debug']], ['label' => 'MAIN NAVIGATION', 'header' => true], // here // ... a group items ['label' => '', 'header' => true], // ... a group items ['label' => '', 'header' => true], // ... a group items
为项添加徽章
'items' => [ [ 'label' => 'Mailbox', 'iconType' => 'far', 'icon' => 'envelope', 'url' => ['/mailbox'], 'badge' => '<span class="badge badge-info right">123</span>' ], ]
默认情况下,图标将添加Font Awesome的前缀
Gii CRUD生成器模板
告诉Gii关于我们的模板。设置在配置文件中完成
if (YII_ENV_DEV) { $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', 'generators' => [ // HERE 'crud' => [ 'class' => 'yii\gii\generators\crud\Generator', 'templates' => [ 'adminlte' => '@vendor/ovidiupop/yii2-adminlte-asset/gii/templates/crud/simple', ] ] ], ]; }
更多信息
有关AdminLTE文档,请阅读https://almsaeedstudio.com/themes/AdminLTE/documentation/index.html