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

Modal设置headerBg主题后不生效? #7221

Closed
1 task done
luchanan opened this issue Dec 24, 2023 · 3 comments
Closed
1 task done

Modal设置headerBg主题后不生效? #7221

luchanan opened this issue Dec 24, 2023 · 3 comments

Comments

@luchanan
Copy link

luchanan commented Dec 24, 2023

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.0.8

Environment

window11

Reproduction link

Steps to reproduce

<ConfigProvider :locale="getAntdLocale" :theme="themeConfig">
<AppProvider>
<RouterView />
</AppProvider>
</ConfigProvider>
const themeConfig = computed(() =>
    Object.assign(
      {
        token: {
          colorBgElevated: 'red', // 设置这个,才可以使得headerBg生效
        },
        components: {
          Modal: {
            colorText: 'red', // 生效
            headerBg: 'blue', // 单设置这个,没有效果
          },
        },
      },
      isDark.value ? darkTheme : {},
    ),
  );

简单看了下源码

const modalToken = (0, _internal.mergeToken)(token, {
modalBodyPadding: token.paddingLG,
modalHeaderBg: token.colorBgElevated,
[`${componentCls}-header`]: {
color: token.colorText,
background: token.modalHeaderBg,

取上面的token.colorBgElevated,而不是外面传进来headerBg

如果这样的话,3.x升级到4.x这个样式设置成本有点大,原以为可以把less之前设置的,放到theme,结果不是每个都可以。

现在的解决方案是:新建less文件,写样式取之前less设置过的,但是有点低效,求一个切换成本低的方法。

What is expected?

只设置headerBg能覆盖样式。像之前3.x的时候在vite.config设置'modal-header-bg': 'blue'可以覆盖样式

What is actually happening?

没有效果

@mengxianghan
Copy link

react版设置的比较精细,基本每个组件都可以单独设置,vue版不如3.x好用

Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants