![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js
Justice23
这个作者很懒,什么都没留下…
展开
-
模态窗打开防止底层滑动
let bodyEl = document.bodylet top = 0export function stopBodyScroll(isFixed: boolean){ if (isFixed) { top = window.scrollY bodyEl.style.position = 'fixed' bodyEl.style.top = -top + 'px' document.body.style.overflow = 'hidden' } else .原创 2021-04-01 16:56:37 · 139 阅读 · 0 评论 -
解决foreach异步执行未完成,就执行另一个function的问题
使用newPromise 方法先执行getOnlineList(),forEach完成后,resolve值,再.then()执行其他function,解决异步执行的问题相关代码:const getOnlineList = function() { //需要先遍历的代码 return new Promise(function(resolve, reject) { ...原创 2019-07-29 11:42:30 · 6119 阅读 · 0 评论