1 Star 0 Fork 9

任俸仪 / GoEasyDemo-wxapp-Helloworld

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 815 Bytes
一键复制 编辑 原始数据 按行查看 历史
Zhang Hui 提交于 2020-04-28 19:25 . refactor the code
//app.js
App({
onLaunch: function () {
this.extendDateFormat();
},
extendDateFormat () {
Date.prototype.formatDate = function (fmt) {
var o = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
"S": this.getMilliseconds()
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if(o.hasOwnProperty(k)){
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
}
return fmt;
};
}
})
JavaScript
1
https://gitee.com/renfengyi/GoEasyDemo-wxapp-Helloworld.git
git@gitee.com:renfengyi/GoEasyDemo-wxapp-Helloworld.git
renfengyi
GoEasyDemo-wxapp-Helloworld
GoEasyDemo-wxapp-Helloworld
master

搜索帮助