阅读背景:

小程序 - 倒计时

来源:互联网 
let timerFn = null;
const wxTimer = require('../util/wxTimer.js');

Page({
	data: {
		date: '2019/03/14 18:00'
	},

	onLoad: function () {
		const td = this.data;

		timerFn = new wxTimer({
			endTime: new Date(td.date).getTime(),
			beginTime: Date.now()
		});

		timerFn.start(this);
	},

	onShow: function () {
		if (!this.data.canShow) return;

		if (timerFn) {
			timerFn.calibration();
			timerFn.start(this);
		}
	},

	onHide: function () {
		timerFn && timerFn.stop();
	},

	changeTime: function (e) {
		this.data.time = e.detail.value;
		this.onHide();
		this.onLoad();
	},
});let timerFn = null;
const wxTimer = re



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: