This article describes how to introduce bootstrap. js in Yii2 advanced edition, which has some reference value. if you are interested, you can refer to it. This article describes how to introduce bootstrap. js in Yii2 advanced edition, which has some reference value. if you are interested, you can refer to it.
In frontend/assets/AppAsset. php
Sample code
Namespace frontend \ assets; use yii \ web \ AssetBundle;/*** Main frontend application asset bundle. */class AppAsset extends AssetBundle {public $ basePath = '@ webroot'; public $ baseUrl =' @ web'; public $ css = ['css/site.css ',]; public $ js = ['JS/main. JS',]; public $ depends = ['yii \ web \ yiiasset', 'yii \ bootstrap \ bootstrapasset ', // note that 'rmrevin \ yii \ fontawesome \ assetbundle' is required here,];}
In the file vendor/yiisoft/yii2-bootstrap/BootstrapAsset. php
Namespace yii \ bootstrap; use yii \ web \ AssetBundle;/*** Asset bundle for the Twitter bootstrap css files. ** @ since 2.0 */class BootstrapAsset extends AssetBundle {public $ sourcePath = '@ bower/bootstrap/dist'; public $ css = ['css/bootstrap.css',]; // the following code is added: public $ js = ['JS/bootstrap. JS',];}
OK
The above is a detailed description of the sample code introduced by bootstrap. js in Yii2 Advanced Edition. For more information, see other related articles in the first PHP community!