Cary_Ye
不知道为什么都没有人回帖 , 我把问题结了吧 . 有不对或者需要补充的地方请不吝跟进。
在 yin\web\View 中 , endBody 方法有两个作用 , 第一是触发 EVENT_END_BODY 事件 , 第二 , 是注册依赖资源
在 156 行可以看到 $this->trigger(self::EVENT_END_BODY); 当然 , 也 echo EVENT_END_BODY
然后 , 在 159 行
foreach (array_keys($this->assetBundles) as $bundle) {$this->registerAssetFiles($bundle);
}
这只是注册所有其他地方的依赖资源而已 , 默认 index 模板中的三个 js 的真正注册地点是
/vendor/yiisoft/yii2-bootstrap/NavBar.php ( 在 layouts 中有引用导航挂件 )
的 142 行 BootstrapPluginAsset::register($this->getView());
这儿注册了一个 bootstrap.js , 同时 depends query 和 bootstrap .
另外 , AppAsset depends JqueryAsset .
所以 endBody 部分的三个 js 引用来自于 AppAsset 和 BootstrapPluginAsset -_-|||...总结的比较二 , 请大神补充?