相关疑难解决方法(0)

覆盖控制器中的 Yii2 assetManager 配置

我使用 yii-jui 在视图中添加一些 UI 元素,例如 datePicker。在frontend\config\main-local.php我设置以下内容来更改 JqueryUI 使用的主题:

$config = [
    'components' => [
        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => 'gjhgjhghjg87hjh8878878',
        ],
        'assetManager' => [
            'bundles' => [
                'yii\jui\JuiAsset' => [
                    'css' =>                    
                      ['themes/flick/jquery-ui.css'],
                ],
            ],
        ],
    ],
];
Run Code Online (Sandbox Code Playgroud)

我尝试了以下方法来覆盖控制器操作方法中的此配置项:

public function actions() {  

      Yii::$app->components['assetManager'] = [
            'bundles' => [
                'yii\jui\JuiAsset' => [
                    'css' =>                    
                      ['themes/dot-luv/jquery-ui.css'],
                ],
            ],
        ]; …
Run Code Online (Sandbox Code Playgroud)

php oop yii-components yii2 yii2-advanced-app

5
推荐指数
1
解决办法
5469
查看次数

标签 统计

oop ×1

php ×1

yii-components ×1

yii2 ×1

yii2-advanced-app ×1