今天在写项目(Vue3+TS)的时候遇见了报错
ERROR
ResizeObserver loop completed with undelivered notifications.
at handleError (webpack-internal:///./node_modules/webpack-dev-server/client/overlay.js:299:58)
at eval (webpack-internal:///./node_modules/webpack-dev-server/client/overlay.js:318:7)
原因我也不是很清楚,问了GPT,回答如下
直接说解决方案:
在App.vue文件中加入防抖函数就行了,debounce方法可以自己写,我为了保持稳定性,采用了lodash
import { debounce } from "lodash";
const _ = (window as any).ResizeObserver;
(window as any).ResizeObserver = class ResizeObserver extends _ {
constructor(callback: (...args: any[]) => void) {
callback = debounce(callback, 100);
super(callback);
}
};
},