liyifei/ yii2-adminlte
使用adminlte的简单方法
1.1.1
2021-11-11 02:48 UTC
Requires
- liyifei/yii2-base: ~1.0
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-09-11 09:13:53 UTC
README
使用adminlte的简单方法
安装
安装此扩展的首选方法是通过 composer。
运行以下命令之一:
php composer.phar require --prefer-dist liyifei/yii2-adminlte "*"
或者在您的 composer.json 文件的 require 部分添加:
"liyifei/yii2-adminlte": "*"
到
使用
安装扩展后,只需在代码中通过
<?= \liyifei\adminlte\AutoloadExample::widget(); ?>
配置assetmanager,使用自带的jquery及bootstrap替换yii2的jquery及bootstrap
'components' => [ 'assetManager'=>[ 'bundles'=>[ 'yii\web\JqueryAsset'=>[ 'class'=>'liyifei\adminlte\bundles\JqueryAsset' ], 'yii\bootstrap\BootstrapAsset'=>[ 'class'=>'liyifei\adminlte\bundles\BootstrapAsset' ] ] ], ],
日期选择器
<?= DatePicker::widget([ 'name' => 'asdfsadf', 'value' => '2015-10-22', ]) ?>
日期范围选择器
<?= DateRangePicker::widget([ 'name' => 'qwer', 'value' => '' ]) ?>
<?= DateRangePicker::widget([ 'name_start' => 'q[wer]', 'name_stop' => 'a[sdf]', 'value_start' => '2015-10-22', 'value_stop' => '2015-11-22', 'seperate' => true ]) ?>
日期时间范围选择器
<?= DateTimeRangePicker::widget([ 'name' => 'qwera', 'value' => '' ]) ?>
<?= DateTimeRangePicker::widget([ 'name_start' => 'q[werx]', 'name_stop' => 'a[sdfx]', 'value_start' => '2015-10-22', 'value_stop' => '2015-11-22', 'seperate' => true ]) ?>
时间选择器
<?= TimePicker::widget([ 'name' => 'asdfsadf', 'value' => '11:11', ]) ?>
<?= TimePicker::widget([ 'name' => 'asdfsadf', 'value' => '11:11:11', ]) ?>
颜色选择器
<?= ColorPicker::widget([ 'name' => 'asdfsadf', 'value' => '#db3d3d', ]) ?>
选择
<?= Select::widget([ 'name' => 'asdfasdf', 'multiple' => true, 'value' => ['a', 'b'], 'options' => [ 'a' => 'aaaa', 'b' => 'bbbb', 'c' => 'cccc' ] ]) ?>
复选框
<?= Checkbox::widget([ 'name' => 'asdf', 'checked' => true, 'label' => 'asdfasdf' ]) ?>
单选按钮
<?= Radio::widget([ 'name' => 'asdf', 'values' => [ ['label' => 'asdfasdf', 'checked' => true], ['label' => 'qwerqwer', 'enable' => false] ] ]) ?>
模态框
<?php Modal::begin([ 'size' => Modal::SIZE_LARGE, 'header' => 'Hello world', 'toggleButton' => ['label' => 'click me'], ]); echo 'Say hello...'; Modal::end(); ?>
标签页
<?= Tabs::widget([ 'items' => [ [ 'label' => 'One', 'content' => 'Anim pariatur cliche...', 'active' => true ], [ 'label' => 'Two', 'content' => 'Anim pariatur cliche...', 'options' => ['id' => 'myveryownID'], ], [ 'label' => 'Example', 'url' => 'http://www.example.com', 'linkOptions'=>['target'=>'_blank'], ], [ 'label' => 'Dropdown', 'items' => [ [ 'label' => 'DropdownA', 'content' => 'DropdownA, Anim pariatur cliche...', ], [ 'label' => 'DropdownB', 'content' => 'DropdownB, Anim pariatur cliche...', ], ], ], ], ]); ?>