|
@@ -15,7 +15,10 @@ Component({
|
|
|
ready: function () { },
|
|
|
pageLifetimes: {
|
|
|
// 组件所在页面的生命周期函数
|
|
|
- show: function () { },
|
|
|
+ show: function () {
|
|
|
+ const that = this;
|
|
|
+ that.search();
|
|
|
+ },
|
|
|
hide: function () { },
|
|
|
resize: function () { },
|
|
|
},
|
|
@@ -23,14 +26,7 @@ Component({
|
|
|
* 组件的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- dateTimeArray: [
|
|
|
- ['2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010'],
|
|
|
- ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
|
|
|
- ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'],
|
|
|
- ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'],
|
|
|
- ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59'],
|
|
|
- ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59'],
|
|
|
- ],
|
|
|
+ dateTimeArray: [],
|
|
|
// 计算日期
|
|
|
year: '',
|
|
|
moneh: '',
|
|
@@ -39,6 +35,25 @@ Component({
|
|
|
* 组件的方法列表
|
|
|
*/
|
|
|
methods: {
|
|
|
+ // 查询时间
|
|
|
+ search: function () {
|
|
|
+ const that = this;
|
|
|
+ // 计算年份
|
|
|
+ let year = [];
|
|
|
+ let startYear = moment().format('YYYY');
|
|
|
+ let endYear = Number(startYear) + 100;
|
|
|
+ for (var i = startYear; i <= endYear; i++) { year.push(String(i)) }
|
|
|
+ // 数组数据, 年, 月, 日, 时, 分, 秒;
|
|
|
+ let dateTimeArray = [
|
|
|
+ [...year],
|
|
|
+ ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
|
|
|
+ ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'],
|
|
|
+ ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'],
|
|
|
+ ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59'],
|
|
|
+ ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59'],
|
|
|
+ ]
|
|
|
+ that.setData({ dateTimeArray })
|
|
|
+ },
|
|
|
// 确认选择
|
|
|
change: function (e) {
|
|
|
const that = this;
|