|
- <?php
- /**
- * Created by PhpStorm.
- * User: Steven
- * Date: 2016/12/17
- * Time: 17:22
- */
- namespace backend\modules\hotel\assets;
-
- use backend\assets\AppAsset;
- use yii\web\AssetManager;
-
- class hotelAsset extends AppAsset
- {
-
- public $sourcePath = '@backend/modules/hotel/assets';
- public $css = [
- 'css/layout.css',
- 'css/loader.css'
- ];
- public $js = [
- 'js/htCommon.js',
- 'js/hotel_report.js',
- ];
-
- public $depends = [
- 'yii\web\YiiAsset',
- 'yii\bootstrap\BootstrapPluginAsset',
- ];
-
- public $publishOptions = [
- 'forceCopy' => true,
- //you can also make it work only in debug mode: 'forceCopy' => YII_DEBUG
- ];
-
- //定义按需加载JS方法
- public static function addScript($view, $jsfile)
- {
- $AssetManager = new AssetManager();
- $jsfile = $AssetManager->getPublishedUrl('@backend/assets') . $jsfile;
- $view->registerJsFile($jsfile, [hotelAsset::className(), 'depends' => 'backend\modules\hotel\assets\hotelAsset']);
- }
-
- //定义按需加载css方法
- public static function addCss($view, $cssfile)
- {
- $AssetManager = new AssetManager();
- $cssfile = $AssetManager->getPublishedUrl('@backend/assets') . $cssfile;
- $view->registerCssFile($cssfile, [hotelAsset::className(), 'depends' => 'backend\modules\hotel\assets\hotelAsset']);
- }
- }
|