我尝试在bootstrap.bundle.js
之后包含js文件。我的视图中有此内容
$this->registerJsFile('https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/bootstrap-select.min.js', ['depends' => [yii\bootstrap4\BootstrapAsset::className()]]);
$this->registerCssFile('https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css', ['depends' => [yii\bootstrap4\BootstrapAsset::className()]]);
但是当我查看源代码时。它仍然显示在它上面。有什么想法如何解决这个问题吗?谢谢
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.js"></script>
<script src="/yii2/frontend/web/assets/949bae38/yii.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.18/dist/sweetalert2.all.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mhayes-twentytwenty/2.0.0-beta.1/jquery.twentytwenty.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/bootstrap-select.min.js"></script>
<script src="/yii2/frontend/web/assets/949bae38/yii.validation.js"></script>
<script src="/yii2/frontend/web/assets/949bae38/yii.activeForm.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"></script>
<script src="/yii2/frontend/web/assets/536f059b/js/bootstrap.bundle.js"></script>
1条答案
按热度按时间hivapdat1#
yii\bootstrap4\BootstrapAsset
只加载bootstrap.css文件。bootstrap.bundle.js由yii\bootstrap4\BootstrapPluginAsset
加载。您只需在该调用中更改Asset类,如下所示: