var dateTimePicker = require('../dateTimePicker.js') Page({ data: { dateTime:'', dateTimeArray:'', startT:'' }, onLoad: function (options) { var start = '2019-04-26 15:26' var obj = dateTimePicker.dateTimePicker(2015,2020,start); this.setData({ dateTime: obj.dateTime, dateTimeArray: obj.dateTimeArray }); var startT = dateTimePicker.formatPickerDateTime(this.data.dateTimeArray,this.data.dateTime) console.log(startT); this.setData({ startT: startT }) }, //获取时间日期 changeDateTime(e) { this.setData({ dateTime: e.detail.value }) var startT = dateTimePicker.formatPickerDateTime(this.data.dateTimeArray, this.data.dateTime) this.setData({ startT: startT }) }, })