<div class="mui-content-padded">
<h5 class="mui-content-padded">开始日期时间</h5>
<button id='pickDateBegBtn' type="button" data-options='{}' class="btn mui-btn mui-btn-block" onclick="DateTimeInput('pickDateBegBtn','begTime')">选择开始日期时间...</button>
</div>
<div class="mui-content-padded">
<h5 class="mui-content-padded">结束日期时间</h5>
<button id='pickDateEndBtn' type="button" data-options='{}' class="btn mui-btn mui-btn-block" onclick="DateTimeInput('pickDateEndBtn','endTime')">选择结束日期时间...</button>
</div>
<div class="mui-content-padded" style="margin: 5px;">
<form class="mui-input-group">
<div class="mui-input-row">
<label>开始时间:</label>
<input type="text" id="begTime" class="mui-input-clear" placeholder="开始日期时间">
</div>
<div class="mui-input-row">
<label>结束时间:</label>
<input type="text" id="endTime" class="mui-input-clear" placeholder="结束日期时间">
</div>
<div class="mui-input-row">
<label>加班时数:</label>
<input type="text" class="mui-input-speech mui-input-clear" placeholder="语音输入">
</div>
//函数,传入 日期按钮对象 和 日期输入框对象
function DateTimeInput(objName_btn,objName_Input)
{
var begTime = document.getElementById(objName_Input);
document.getElementById(objName_btn).addEventListener('tap', function() {
var _self = this;
if(_self.picker) {
_self.picker.show(function (rs) {
begTime.value = rs.text;
});
} else {
var optionsJson = this.getAttribute('data-options') || '{}';
var options = JSON.parse(optionsJson);
_self.picker = new mui.DtPicker(options);
_self.picker.show(function(rs) {
begTime.value = rs.text;
});
};
});
};
日期选择的BUTTON为什么按钮要按2次才能弹出日期选择框?但只是第一次打开界面会这样,以后就正常了,是不是哪里要初始化一下?
0 个回复