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

在Storybook中定制主题的时候,无法设置ColorBgBase等token的值 #8110

Open
1 task
powanjuanshu opened this issue Apr 1, 2025 · 2 comments
Open
1 task

Comments

@powanjuanshu
Copy link

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

Version

4.2.6

Environment

"storybook": "8.3.5","vue": "^3.2.0","ant-design-vue": "^4.2.6",

Reproduction link

https://github.com/vueComponent/ant-design-vue

Steps to reproduce

/** @type { import('@storybook/vue3').Preview } */
import { setup } from '@storybook/vue3'
import Antd, { theme as antdTheme } from 'ant-design-vue'

import 'ant-design-vue/dist/reset.css'

// 安装组件库
setup(app => {
app.use(Antd)
})

const withThemeProvider = storyFn => ({
components: { Story: storyFn() },
setup() {
const { defaultAlgorithm } = antdTheme

const themeConfig = {
algorithm: defaultAlgorithm,
token: {
colorBgBase: '#ffffffa0',
colorBgLayout: '#f5f5f5a0',
colorBgContainer: '#ffffffa0',
colorBgElevated: '#ffffffa0',
colorBgSpotlight: '#000000a0'
}
}

return {
themeConfig
}
},
template: ''
})

const preview = {
decorators: [withThemeProvider],
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i
}
},
backgrounds: {
default: 'light',
values: [
{ name: 'light', value: '#F8F8F8' },
{ name: 'dark', value: '#333333' }
]
}
}
}

export default preview

What is expected?

在开发环境中设置的背景色生效,但是打包后无效,期望始终生效

What is actually happening?

配置colorBgBase为#ff0000都不行

@powanjuanshu
Copy link
Author

补充一个现象,编写的依赖ant-design-vue的组件库打包后,在应用中使用的时候才会出现这个问题

@powanjuanshu
Copy link
Author

打包的时候已经排除。
rollupOptions: {
  external: ['vue', 'ant-design-vue', '@ant-design/icons-vue']
}

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

1 participant