vue3.0 + TS ResizeObserver loop limit exceeded报错原因及解决方案
/ ResizeObserver loop limit exceeded报错原因及解决方案。放到 main.ts中。
·
// ResizeObserver loop limit exceeded报错原因及解决方案
const debounce = (fn: any, delay: any) => {
let timer = null as any
return function () {
const args = [] as any
clearTimeout(timer)
timer = setTimeout(function () {
fn.apply(...args)
}, delay)
}
}
const _ResizeObserver = window.ResizeObserver
window.ResizeObserver = class ResizeObserver extends _ResizeObserver {
constructor (callback: any) {
callback = debounce(callback, 16)
super(callback)
}
}
放到 main.ts中
更多推荐
已为社区贡献1条内容
所有评论(0)