js实现sleep

console.log("start");
await new Promise(function(resolve, reject) {
         setTimeout(function(){
                    $('.tips-box').hide();
                    $('.tips-box').attr("date-id","1");
                    console.log("2.5s后");
                    resolve({status:1})
         }, 2500)
})  
console.log("end");      

 

posted @ 2019-11-19 11:58  不知起什么名字  阅读(226)  评论(0编辑  收藏  举报