在vue中封装一个定时器
时间:2019-07-14 21:56:49
收藏:0
阅读:610
在main.js中进行封装
Vue.prototype.$sleep = time => {
return new Promise((resolve, reject) => {
window.setTimeout(() => {
resolve()
}, time)
})
}
这样就可以全局当中使用了。
直接$sleep(时间参数)
原文:https://www.cnblogs.com/lljun/p/11185649.html
评论(0)