我正在分享我想做的事情的链接(链接中的最后一个,即日期时间)
https://rsuite.github.io/multi-date-picker/
这样做之后,我想将这些条目存储在可观察数组中
注意:我想在简单的记事本和 jQuery 日期时间选择器中完成这一切
function Friend() {
$(document).ready(function() {
$("#datetime").datetimepicker();
});
var self = this;
self.dates = ko.observable();
self.removeFriend=function() {
obj.friends.remove(self);
}
}
var obj = {
friends:ko.observableArray([new Friend()])
};
obj.addFriend=function() {
obj.friends.push(new Friend());
}
ko.applyBindings(obj);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script>
<script src="
https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.min.css">
<h1>Hello JS</h1>
<ul data-bind="foreach:friends">
<li>
<input readonly type="text" id="datetime" data-bind="value:dates" />
<button data-bind="click: removeFriend">Remove Employee</button>
</li>
</ul>
<button data-bind="click: addFriend">Add Employee</button>
我对此很陌生。