new-api
new-api copied to clipboard
fix(web): Semi Design 按钮样式被 Tailwind preflight 覆盖
Summary
安全设置页面的 Semi Design 按钮样式丢失(背景透明),原因是 CSS @layer 优先级顺序错误。
Root Cause
Vite 构建后,semi-ui-*.css(含 @layer semi{...})在 index-*.css(含 layer 顺序声明)之前加载。按 CSS 规范,layer 优先级由首次出现顺序决定,semi 成为最低优先级 layer,导致 Tailwind preflight 的 button { background: transparent } 覆盖了 Semi 的 .semi-button-primary { background: var(--semi-color-primary) }。
Fix
- 在
web/index.html的<head>中添加内联<style>@layer tailwind-base, semi, tailwind-components, tailwind-utils;</style>,确保在所有外部样式表之前声明 layer 顺序 - 移除组件中无效的
!bg-slate-*类(slate 不在 Tailwind 调色板中,属于无效样式)
Affected Files
web/index.htmlweb/src/components/settings/personal/cards/AccountManagement.jsxweb/src/components/settings/personal/components/TwoFASetting.jsxweb/src/components/settings/personal/modals/WeChatBindModal.jsx