【发布时间】:2020-08-20 11:23:49
【问题描述】:
当我在 uk-dropdown Uikit 中使用 select2 下拉菜单并选择了一个选项时,它会自动关闭模式。
这里是代码笔:Codepen
// In your JavaScript code (external .js resource or <script> tag)
$(document).ready(function() {
$('.js-example-basic-single').select2();
});
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js"></script>
</head>
<body>
<button class="uk-button uk-button-default" type="button">Click</button>
<div uk-dropdown="mode:click">
sfsdf
<select class="js-example-basic-single" name="state">
<option value="AL">Alabama</option>
...
<option value="WY">Wyoming</option>
</select>
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
</div>
</body>
</html>
【问题讨论】:
标签: jquery uikit jquery-select2