?>

Wie kann man jQuery in yii2 überschreiben?

Eine Option wäre das folgende Beispiel:

Fügen Sie in der Konfigurationsdatei des Projekts @ frontend / config / main.php Folgendes hinzu:

Eine Option wäre das folgende Beispiel:

Fügen Sie in der Konfigurationsdatei des Projekts @ frontend / config / main.php Folgendes hinzu:

'components' => [ 'view' => [ 'on beforeRender' => function () { if (!\skeeks\cms\backend\BackendComponent::getCurrent()) { \Yii::$app->assetManager->bundles['yii\web\JqueryAsset'] = [ 'class' => '\frontend\assets\YourJqueryAsset', ]; } }, ], ] 

Frontend \ Assets \ YourJqueryAsset:

namespace frontend\assets; /** * @author Semenov Alexander <semenov@skeeks.com> */ class DigiproJsPluginsAsset extends DigiproAsset { public $sourcePath = '@webroot/'; public $css = []; public $js = [ 'jquery-version.min.js', ]; public $depends = []; } 

Option Redefinition nicht nur Jquery, sondern auch alle anderen Skripte.

Alle Kommentare (0)
Keine Kommentare