修复Date.prototype.format方法问题
This commit is contained in:
@@ -1,29 +1,3 @@
|
|||||||
/**
|
|
||||||
* 扩展date函数
|
|
||||||
* author:c3gen
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default Date.prototype.format = function (format) {
|
|
||||||
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(format)) {
|
|
||||||
format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
||||||
}
|
|
||||||
for (var k in o) {
|
|
||||||
if (new RegExp("(" + k + ")").test(format)) {
|
|
||||||
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function showLoading() {
|
export function showLoading() {
|
||||||
$(".loadingGif").css('top', window.innerHeight / 2);
|
$(".loadingGif").css('top', window.innerHeight / 2);
|
||||||
$(".loadingGif").css('left', window.innerWidth / 2);
|
$(".loadingGif").css('left', window.innerWidth / 2);
|
||||||
|
@@ -20,6 +20,31 @@ export default {
|
|||||||
FooterView
|
FooterView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展date函数
|
||||||
|
* author:c3gen
|
||||||
|
*/
|
||||||
|
Date.prototype.format = function (format) {
|
||||||
|
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(format)) {
|
||||||
|
format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||||
|
}
|
||||||
|
for (var k in o) {
|
||||||
|
if (new RegExp("(" + k + ")").test(format)) {
|
||||||
|
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return format;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
Reference in New Issue
Block a user