Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nextjs中使用会导致组件样式丢失 #548

Open
jxgzzztang opened this issue Feb 20, 2025 · 4 comments
Open

Nextjs中使用会导致组件样式丢失 #548

jxgzzztang opened this issue Feb 20, 2025 · 4 comments

Comments

@jxgzzztang
Copy link

No description provided.

Copy link

在 Next.js 中使用 ant-design/x 时,如果遇到组件样式丢失的问题,通常可能是由于样式加载顺序或样式配置不当引起的。以下是一些可能的解决方案:

  1. 确保样式正确引入

    • 确保在 _app.js_app.tsx 中正确引入了 ant-design/x 的样式文件。
    • 示例:
      import 'antd/dist/antd.css'; // 引入 antd 的样式
  2. 检查样式优先级

    • 确保自定义样式没有覆盖 ant-design/x 的样式。
    • 使用开发者工具检查样式优先级,确保 ant-design/x 的样式被正确应用。
  3. 服务器端渲染 (SSR) 配置

    • 确保在服务器端渲染时,样式被正确收集和注入。
    • 可以使用 next-plugin-antd-less 或其他相关插件来帮助处理样式。
  4. 检查样式冲突

    • 确保没有其他全局样式或 CSS 重置影响到 ant-design/x 的样式。

如果以上方法未能解决问题,可能需要进一步检查项目的具体配置或提供更多详细信息以便更好地帮助解决问题。

如果您有更多细节或需要进一步的帮助,请随时告知。

🪧 Tips For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.

@jxgzzztang
Copy link
Author

Nextjs结合tailwind css使用antd 和 antdx会导致组件样式丢失

@hylin
Copy link

hylin commented Mar 7, 2025

您好, @jxgzzztang 基于当前提供的信息无法进行排查,能否给下在线case或者复现路径。

@jxgzzztang
Copy link
Author

jxgzzztang commented Mar 11, 2025

您好, @jxgzzztang 基于当前提供的信息无法进行排查,能否给下在线case或者复现路径。

问题与这里提到的一致,559
layer配置导致的,目前我已经通过patch打补丁的方式解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants