thtmorais / yii2-pace
PACE (Progress Automatically Certain to Entertain) - Yii PHP 框架的自动页面加载进度条
1.2.4.1
2021-06-11 02:43 UTC
Requires
- npm-asset/pace-js: 1.2.4
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2024-09-15 20:58:28 UTC
README
PACE (Progress Automatically Certain to Entertain) - Yii PHP 框架的自动页面加载进度条
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一:
composer require thtmorais/yii2-pace "*"
或者添加以下内容到您的 composer.json 文件的 require 部分:
"thtmorais/yii2-pace": "*"
使用
扩展安装后,只需在代码中使用它即可
<?php use thtmorais\pace\Pace; echo Pace::widget(); ?>
或
<?= \thtmorais\pace\Pace::widget() ?>
我们建议在 layouts/main.php 文件中使用。或者如果您更愿意在每个视图文件中使用各自的设置。
配置
默认情况下,PACE 配置为蓝色和最小动画。
您可以在 config/params.php 文件中添加所有视图的一般规则,如下所示
<?php return [ 'paceOptions' => [ 'color' => 'blue', 'theme' => 'minimal', 'options' => [] ] ]; ?>
或者在每个视图中单独添加
<?php use thtmorais\pace\Pace; echo Pace::widget([ 'color'=>'red', 'theme'=>'corner-indicator', 'options'=>[] ]); ?>
您可以在 这里 预览 主题 和 颜色。