路过
路过的甲楼主
next/image 图片模糊或变形,检查:① 是否设置了 width/height 或 fill ② fill 模式需要父容器 position: relative ③ priority 只给 LCP 图片 ④ sizes 属性帮助浏览器选择正确尺寸 ⑤ 避免在 Server Component 中用 ssr:false 包装。 Tailwind v4 升级后样式失效,大版本升级有 breaking changes。检查:① tailwind.config.ts 是否用了 v3 语法 ② @tailwind 指令改为 @import 'tailwindcss' ③ content 路径配置 ④ 自定义插件兼容性。建议看官方迁移指南。 遇到 hydration mismatch 报错,一般是服务端和客户端渲染的 HTML 不一致。常见原因:① 在组件中用了 Date.now() 或 Math.random() ② 用了 window/document 等浏览器 API ③ 服务端和客户端时区不同。解决:把动态值放到 useEffect 里设置,或加 suppressHydrationWarning。 Shadcn UI 组件在 Server Component 报错,因为部分组件用了 Radix UI(Client Component)。确保使用 Shadcn 组件的页面或父组件加了 'use client',或者把组件包裹在 Client Component wrapper 中。 Prisma Json 字段查询,用 prismaToJson 过滤或 $queryRaw 用 PostgreSQL 的 ->> 操作符。Prisma 6 支持直接在 where 中用 path 过滤 Json 字段。