select2 位于 bootstrap 4 模态中,并且仅发生在模态中。
请参阅上面的屏幕截图,当我单击该元素时,它会显示,然后关闭。
在 Chrome 控制台中,我看到这些警告
[Violation] Avoid using document.write().
[Violation] Forced reflow while executing JavaScript took 33ms
[Violation] 'readystatechange' handler took 151ms
Run Code Online (Sandbox Code Playgroud)
这是我的代码
[Violation] Avoid using document.write().
[Violation] Forced reflow while executing JavaScript took 33ms
[Violation] 'readystatechange' handler took 151ms
Run Code Online (Sandbox Code Playgroud)
P/S:这并不总是发生
我想我已经在这里找到了解决方案,我错过的是.modal-content
dropdownParent: $('#bootstrap4-modal .modal-content'),
Run Code Online (Sandbox Code Playgroud)
现在 select2 正确显示
| 归档时间: |
|
| 查看次数: |
2374 次 |
| 最近记录: |