bootstrap-select 與bootstrap 4兼容性問題 Cannot set property '_menu' of undefined

bootstrap-select默認只支持bootstrap 3+jquery

支持4.0須要額外引入一個popper.js文件ajax

bootstrap官網有解釋:bootstrap

https://getbootstrap.com/docs/4.1/getting-started/introduction/spa

翻譯以下:翻譯

引入順序以下便可。調試

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

 

假如以上方法還沒解決。code

通過逐一調試發現。cdn

bootstrap4.0仍然沒法兼容bootstrap-select,須要將bootstrap4.0改爲4.1.3版本便可blog

相關文章
相關標籤/搜索