首页 > 代码库 > Knockout自定义绑定my97datepicker

Knockout自定义绑定my97datepicker

/*             my97datepicker  时间格式‘yyyy-MM-dd HH-mm-ss‘           */       ko.bindingHandlers.datetimes = {           init: function (element, valueAccessor, viewModel) {               var value = http://www.mamicode.com/ko.utils.unwrapObservable(valueAccessor());"class", "Wdate");               $(element).focus(function () {                   WdatePicker({                       isShowClear: false, readOnly: true, dateFmt: ‘yyyy-MM-dd HH:mm:ss‘                   });               });               $(element).val(value);           },           update: function (element, valueAccessor, viewModel) {               var value = http://www.mamicode.com/ko.utils.unwrapObservable(valueAccessor());>
<input id="date_times" data-bind="datetimes:forms.dates" data-options="required:true" style="width: 150px;" />

  

Knockout自定义绑定my97datepicker