// 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中

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐