uniapp拼團倒計時函數


            limitFormatTime(date) {
				var that=this;
			    // 日期格式為 [2019-05-09 20:10:10]
			    date = date.replace(/\-/g,'/');
			    var timestamp = (new Date(date)).valueOf();
			    var nowstr = (new Date()).valueOf();
				setInterval(function(){
					nowstr=nowstr-1000
				},1000)
			    var chazhi = (timestamp - nowstr)/1000;
			    if (chazhi < 0) {
			        chazhi = 0;
			    }
			    var d = Math.floor(chazhi / 3600 / 24);
			    var h = Math.floor((chazhi / 3600) % 24);
			    var m = Math.floor((chazhi % 3600) / 60);
			    var s = Math.floor((chazhi % 3600) % 60);
			    if (h < 10) {
			        h = "0" + h;
			    }
			    if (m < 10) {
			        m = "0" + m;
			    }
			    if (s < 10) {
			        s = "0" + s;
			    }
				
				return d + "天" + h + "時" + m + "分" + s + "秒"
			}                

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM