Laravel 8 - Bootstrap 5 Bootstrap-select 不显示选项
我正在尝试通过 laravel mix 在 laravel 中设置 bootstrap-select。一切看起来都是正确的,但是当单击选择时,它不显示选项。
在 resources/js/Bootstrap.js 中,我在 jquery 之前添加了库、popper,在之后添加了 bootrstrap 和 bootstrap-select。
const { popper } = require('@popperjs/core');
window._ = require('lodash');
try {
require('bootstrap');
window.$ = require('jquery');
window.jQuery = require('jquery');
require("jquery-datetimepicker");
require("bootstrap-select");
} catch (e) {}
在刀片模板中,我有以下代码:
<select class="form-control" id="user" data-live-search="true">
<option value="0">one</option>
<option value="1">optionX</option>
<option value="2">optionX</option>
<option value="3">optionX</option>
<option value="4">optionX</option>
<option value="5">optionX</option>
</select>
<script>
$( document ).ready(function() {
$('select').selectpicker();
});
</script>
似乎一切都正确,显示了选择,并且控制台中没有错误,但按下不显示选项。
I am trying to set bootstrap-select in laravel via laravel mix. Everything seems correct, but when clicking on the select, it does not show the options.
In resources/js/Bootstrap.js I add the libs, popper before jquery and bootrstrap and bootstrap-select later.
const { popper } = require('@popperjs/core');
window._ = require('lodash');
try {
require('bootstrap');
window.$ = require('jquery');
window.jQuery = require('jquery');
require("jquery-datetimepicker");
require("bootstrap-select");
} catch (e) {}
In the blade template I have the following code:
<select class="form-control" id="user" data-live-search="true">
<option value="0">one</option>
<option value="1">optionX</option>
<option value="2">optionX</option>
<option value="3">optionX</option>
<option value="4">optionX</option>
<option value="5">optionX</option>
</select>
<script>
$( document ).ready(function() {
$('select').selectpicker();
});
</script>
It seems that everything is correct, the select is shown, and there are no errors in the console, but pressing does not show the options.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Bootstrap 5 不适用于 Bootstrap-select 1.13.xxx。我必须获取 beta/RC 之一才能使其与 Laravel 8 和 Bootstrap 5 一起使用,
我使用过
希望这会有所帮助
Bootstrap 5 doesn't work with Bootstrap-select 1.13.xxx. I had to grab one of beta/RC to get it to work with Laravel 8 and Bootstrap 5
I used
Hope this helps