Failed to construct 'ResizeObserver': Please use the 'new' operator, this DOM object constructor cannot be called as a function. TypeError: Failed to construct 'ResizeObserver': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
时间: 2024-04-13 21:29:39 浏览: 380
java.sql.SQLException: 内部错误: Unable to construct a Datum from the specified input
5星 · 资源好评率100%
这个错误通常是因为在调用 ResizeObserver 构造函数时没有使用 `new` 运算符。正确的用法是使用 `new` 运算符创建 ResizeObserver 实例,例如:
```javascript
const observer = new ResizeObserver(callback);
```
请确保在调用 ResizeObserver 构造函数时添加 `new` 运算符,并将回调函数作为参数传递给它。这样就可以成功创建 ResizeObserver 实例了。
阅读全文