我正在尝试使Bootstrap 4 DateTimePicker工作,从而允许选择多个日期。如果我删除脚本中的“ multidate:true”行,则下面的代码有效。但是,当该行出现时,日期选择器甚至不会显示。 谁能告诉我我在做什么错。 这是复制问题的最少代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<!-- Include Date Picker -->
<script language="javascript" src="https://momentjs.com/downloads/moment.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/js/bootstrap-datetimepicker.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/css/bootstrap-datetimepicker.min.css"/>
</head>
<body>
<div class="form-group ">
<h5 class="border-bottom mb-4">Date Picker</h5>
<div class="input-group datepicker">
<input class="form-control" id="datepicker" name=dates placeholder="yyyy-mm-dd" type="text"/>
<div class="input-group-addon">
<span class="fa fa-calendar"></span>
</div>
</div>
</div>
</body>
<script>
$(document).ready(function() {
$('.datepicker').datetimepicker({
format: "YYYY-MM-DD",
multidate: true
});
});
</script>
</html>
答案 0 :(得分:0)
正确使用所有链接
func configUI() {
view.backgroundColor = .white
view.addSubview(buttonA)
buttonA.snp.makeConstraints {
$0.left.equalToSuperview()
$0.bottom.equalToSuperview().offset(-1)
$0.height.width.equalTo(80)
}
view.addSubview(buttonB)
buttonB.snp.makeConstraints {
$0.right.bottom.equalToSuperview()
$0.height.width.equalTo(80)
}
}
$('#datepicker').datepicker({
format: "yyyy-mm-dd",
multidate: true
});