type
status
date
slug
summary
tags
category
icon
password
Damn❗️Damn❗️Damn❗️
ReferenceError: window is not defined?
在用 next
开发时是否经常遇到 XXX is not defined
!!
🙋♀️🌰:在使用
ahook
时,依赖用window
document
等node
不支持的对象![notion image](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F5a557cce-bd33-465d-a775-0a287b89ed57%2F529d48e1-7911-422a-8189-edd0b1aaa6c7%2Fimage.png?table=block&id=107de343-d833-80da-a635-d414fb9fdd3a&t=107de343-d833-80da-a635-d414fb9fdd3a&width=2309&cache=v2)
那么恭喜你,你应该会看到如下报错
![notion image](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F5a557cce-bd33-465d-a775-0a287b89ed57%2Fde871537-5701-4eaa-8b0f-69fbeb849715%2Fimage.png?table=block&id=107de343-d833-80af-9782-efcef8dbda0a&t=107de343-d833-80af-9782-efcef8dbda0a&width=892.96875&cache=v2)
解决方案
建议封装成hooks
使用
扩展
最近在掘金看见了一个下雪特效,我想这tM不拿到我的网站来试试水!
我看了源码是使用
webComponent
实现的 so easy
!!PS:想要学习
webComponent
可以查看源码对照学习我直接一手
import
,反手给我一个报错!!Damn❗️❗️❗️
报错如下
部分源码如下:
![notion image](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F5a557cce-bd33-465d-a775-0a287b89ed57%2Fee9599e8-b013-4612-9e07-0ab79396694b%2Fimage.png?table=block&id=107de343-d833-8077-a66d-ecea48aed0d2&t=107de343-d833-8077-a66d-ecea48aed0d2&width=892.9921875&cache=v2)
折腾了一段时间也没搜索到教程