biqu / yii2-adminlte-asset
基于 Yii 2.0 框架的 AdminLTE 后端主题资源包
Requires
- almasaeed2010/adminlte: 2.3.8
- cebe/yii2-gravatar: 1.*
- rmrevin/yii2-fontawesome: ~2.9
- yiisoft/yii2: 2.*
- yiisoft/yii2-bootstrap: 2.*
This package is not auto-updated.
Last update: 2024-09-19 12:12:58 UTC
README
基于 AdminLTE 的 Yii2 框架后端 UI

本包包含一个为 Yii 2.0 框架注册 AdminLTE 用户界面 CSS 文件的 资源包
CSS 文件通过 Yii 推荐的使用方式 fxp/composer-asset-plugin v1.1.1 或更高版本进行安装。
安装
安装此扩展的首选方式是通过 composer。
要安装 AdminLTE v2,运行
php composer.phar require dmstr/yii2-adminlte-asset "2.*"
要安装 AdminLTE v1,运行
php composer.phar require dmstr/yii2-adminlte-asset "1.*"
快速入门
一旦安装了扩展,您可以通过重新配置视图组件的路径映射来获得一个 预览
'components' => [
'view' => [
'theme' => [
'pathMap' => [
'@app/views' => '@vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app'
],
],
],
],
对于 Phundament 4
'components' => [
'view' => [
'theme' => [
'pathMap' => [
'@app/views' => '@vendor/dmstr/yii2-adminlte-asset/example-views/phundament/app'
],
],
],
],
此资源包提供了布局和视图的示例文件(请参阅文件夹 examples/),它们 不应用于直接在 vendor/ 文件夹中修改。
因此,建议您将视图复制到您的应用程序中,并根据您的需求进行调整。
定制
- 从
vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app(或其它主题)复制文件到@app/views。 - 如果您之前已经做了,通过删除路径映射来删除您应用程序中的自定义
view配置。 - 编辑您的视图,遵循
vendor/almasaeed2010/adminlte/pages中的 html 标记。
皮肤
默认情况下,该扩展使用蓝色皮肤为 AdminLTE。您可以在配置文件中更改它。
'components' => [
'assetManager' => [
'bundles' => [
'dmstr\web\AdminLteAsset' => [
'skin' => 'skin-black',
],
],
],
],
然后只需替换 body 的类为 skin-blue。如果您不想在更改皮肤颜色时修改每个视图文件,可以使用 AdminLteHelper::skinClass()。
<body class="<?= \dmstr\helpers\AdminLteHelper::skinClass() ?>">
注意:仅当您通过配置覆盖皮肤时使用 AdminLteHelper::skinClass()。否则,您将不会获得 body 的正确 CSS 类。
以下是可用的皮肤列表
"skin-blue",
"skin-black",
"skin-red",
"skin-yellow",
"skin-purple",
"skin-green",
"skin-blue-light",
"skin-black-light",
"skin-red-light",
"skin-yellow-light",
"skin-purple-light",
"skin-green-light"
如果您想使用 AdminLTE 标题的本地 DOM
<h1>
About <small>static page</small>
</h1>
则可以遵循以下代码
/* @var $this yii\web\View */
$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>
左侧边栏菜单 - 菜单小部件
如果您需要将菜单的各个部分分开,只需将 li.header 项目添加到 items
'items' => [
['label' => 'Gii', 'icon' => 'fa fa-file-code-o', 'url' => ['/gii']],
['label' => 'Debug', 'icon' => 'fa fa-dashboard', 'url' => ['/debug']],
['label' => 'MAIN NAVIGATION', 'options' => ['class' => 'header']], // here
// ... a group items
['label' => '', 'options' => ['class' => 'header']],
// ... a group items
['label' => '', 'options' => ['class' => 'header']],
// ... a group items
为项目添加标签
'items' => [
[
'label' => '<span>Mailbox</span><span class="pull-right-container"><small class="label pull-right bg-yellow">' . $mailCount . '</small></span>',
'icon' => 'fa fa fa-envelope-o',
'url' => ['/mailbox'],
'encode' => false,
],
更多信息
有关 AdminLTE 文档,请阅读 https://almsaeedstudio.com/themes/AdminLTE/documentation/index.html
命名空间规则遵循 Yii 2.0 框架结构,例如,Asset Bundle 使用
dmstr\web。