下面的黃色橫條有個(gè)到店,它會(huì)隨著定時(shí)器定下的時(shí)間,然后倒計(jì)時(shí),隨著時(shí)間在減少,到店也會(huì)跟著滑動(dòng),限制在兩小時(shí),最后超過(guò)時(shí)間就彈出提示。
2 回答

慕斯709654
TA貢獻(xiàn)1840條經(jīng)驗(yàn) 獲得超5個(gè)贊
let that = this
let hours = new Date().getHours(); //獲取當(dāng)前小時(shí)let minutes = new Date().getMinutes(); //獲取當(dāng)前分鐘let n = that.data.newTime.match(/(\S*):/)[1] // 截取預(yù)定時(shí)間小時(shí)dataer();// 計(jì)時(shí)器function dataer() { // 如果現(xiàn)在還未到預(yù)定時(shí)間 if (hours < n) { var timerTem = setTimeout(function() { t = minutes * 2 console.log(t) dataer() }, 1000) that.setData({ dao_left: t }) } }
添加回答
舉報(bào)
0/150
提交
取消