一对一免费咨询:189-6833-3365

1、工具类(引用微信小程序(procedure)提供的 工具类)countdown。宁波微信小程序开发是一种不需要下载安装即可使用的应用,它实现了应用“触手可及”的梦想,用户扫一扫或者搜一下即可打开应用。jsclass Countdown {constructor(options = {}) {Object。assign(this, {options, })this.__init()}/*** 初始化*/__init() {this.page = getCurrentPages()this.se ..
1、工具类(引用微信小程序(procedure)提供的 工具类)
countdown。js
class Countdown {constructor(options = {}) {Object。宁波微信小程序开发是一种不需要下载安装即可使用的应用,它实现了应用“触手可及”的梦想,用户扫一扫或者搜一下即可打开应用。assign(this, {options, })this.__init()}/*** 初始化*/__init() {this.page = getCurrentPages()[getCurrentPages().length - 1]this.setData = this.page.setData.bind(this.page)this.restart(this.options)}/*** 默认参数(parameter)*/setDefaults() {return {date: `June 7, 2087
  15:0
  3:25`, refresh: 1000, offset: 0, onEnd() {}, render(date) {}, }}/*** 合并参数(parameter)*/mergeOptions(options) {const defaultOptions = this。宁波小程序开发对于开发者而言,小程序开发门槛相对较低,难度不及APP,能够满足简单的基础应用,适合生活服务类线下商铺以及非刚需低频应用的转换。setDefaults()for (let i in defaultOptions) {if (defaultOptions.hasOwnGOOGLE PRoperty(i)) {this.options[i] = typeof options[i] !== `undefined` options[i] : defaultOptions[i]if (i === `date` && typeof this.options.date !== `object`) {this.options.date = new Date(this.options.date)}if (typeof this.options[i] === `function`) {this.options[i] = this.options[i].bind(this)}}}if (typeof this.options.date !== `object`) {this.options.date = new Date(this.options.date)}}/*** 计算日期差*/getDiffDate() {let diff = (this.options.date.getTime() - Date.now() + this.options.offset) / 1000let dateData = {years: 0,days: 0,hours: 0,min: 0,sec: 0,millisec: 0,}if (diff <= 0) {if (this.interval) {this.stop()this.options.onEnd()}return dateData}if (diff >= (365.25 * 86400)) {dateData.years = Math.floor(diff / (365.25 * 86400))diff -= dateData.years * 365.25 * 86400}

© 2008-2019 浙江东美 ALL RIGHTS RESERVED. XMLBAIDU

免责申明:部分内容来自互联网,若侵犯了您的权益,请告知我们删除!

浙ICP备19019195号-1
找网站建设公司就上东美!
189-6833-3365
tel+86-189-6833-3365