cordova-plugin-datepicker怎么用
1个回答
展开全部
1、app.js的.config里面加入
var timePickerObj = {
inputTime: ((((new Date()).getHours()) * 60 * 60) + ((new Date()).getMinutes() * 60)),
format: 12,
step: 15,
setLabel: '确认',
closeLabel: '取消'
};
ionicTimePickerProvider.configTimePicker(timePickerObj);
//回弹效果
$ionicConfigProvider.scrolling.jsScrolling(true);
var datePickerObj = {
inputDate: new Date(),
setLabel: '确认',
todayLabel: '今天',
closeLabel: '取消',
mondayFirst: false,
weeksList: ["日", "一", "二", "三", "四", "五", "六"],
monthsList: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
templateType: 'popup',
from: new Date(2012, 8, 1),
to: new Date(2018, 8, 1),
showTodayButton: true,
dateFormat: 'dd MMMM yyyy',
closeOnSelect: false
};
ionicDatePickerProvider.configDatePicker(datePickerObj);
2、相应controller里面加入
var datePickerCallBack = {
callback: function (date) { //Mandatory
var timePickerCallBack = {
callback: function (meetingDate) { //Mandatory
var dateTime = (date + meetingDate * 1000);
$scope.meeting.meetingDate = new Date(dateTime);
var myJsDate = $filter('date')($scope.meeting.meetingDate, 'yyyy-MM-dd HH:mm:ss');
$scope.meeting.meetingDate = myJsDate;
}
};
ionicTimePicker.openTimePicker(timePickerCallBack);
}
};
$scope.openDatePicker = function () {
ionicDatePicker.openDatePicker(datePickerCallBack);
};
3、页面上
<input type="text" ng-model="meeting.meetingDate" name="meetingDate" placeholder="选择日期" ng-click="openDatePicker()" required>
var timePickerObj = {
inputTime: ((((new Date()).getHours()) * 60 * 60) + ((new Date()).getMinutes() * 60)),
format: 12,
step: 15,
setLabel: '确认',
closeLabel: '取消'
};
ionicTimePickerProvider.configTimePicker(timePickerObj);
//回弹效果
$ionicConfigProvider.scrolling.jsScrolling(true);
var datePickerObj = {
inputDate: new Date(),
setLabel: '确认',
todayLabel: '今天',
closeLabel: '取消',
mondayFirst: false,
weeksList: ["日", "一", "二", "三", "四", "五", "六"],
monthsList: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
templateType: 'popup',
from: new Date(2012, 8, 1),
to: new Date(2018, 8, 1),
showTodayButton: true,
dateFormat: 'dd MMMM yyyy',
closeOnSelect: false
};
ionicDatePickerProvider.configDatePicker(datePickerObj);
2、相应controller里面加入
var datePickerCallBack = {
callback: function (date) { //Mandatory
var timePickerCallBack = {
callback: function (meetingDate) { //Mandatory
var dateTime = (date + meetingDate * 1000);
$scope.meeting.meetingDate = new Date(dateTime);
var myJsDate = $filter('date')($scope.meeting.meetingDate, 'yyyy-MM-dd HH:mm:ss');
$scope.meeting.meetingDate = myJsDate;
}
};
ionicTimePicker.openTimePicker(timePickerCallBack);
}
};
$scope.openDatePicker = function () {
ionicDatePicker.openDatePicker(datePickerCallBack);
};
3、页面上
<input type="text" ng-model="meeting.meetingDate" name="meetingDate" placeholder="选择日期" ng-click="openDatePicker()" required>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询