详解Yii2高级版引入bootstrap.js的一个办法
在frontend/assets/AppAsset.php
代码示例
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',//注意这里必须要有 'rmrevin\yii\fontawesome\AssetBundle', ]; }
在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', ]; //下面是增加的代码 public $js = [ 'js/bootstrap.js', ]; }
OK了
相关推荐
WasteLand 2020-10-18
Allinputs 2020-08-30
Ashes 2020-06-14
caiyiii 2020-06-14
kxguan 2020-06-14
daillo 2020-06-14
一粒沙里的世界 2020-06-14
ruxingli 2020-06-14
csssy00 2020-06-14
阿佐 2020-06-14
NameWFY 2020-05-28
NameWFY 2020-05-26
Robin罗兵 2020-05-16
caiyiii 2020-04-29
wmsjlihuan 2020-04-26
cbao 2020-04-26
csssy00 2020-04-19
igogo00 2020-03-09