File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
src/uni_modules/wot-design-uni/components/wd-config-provider Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -129,3 +129,10 @@ const themeVars: ConfigProviderThemeVars = {
129129| theme | 主题风格,设置为 ` dark ` 来开启深色模式,全局生效 | string | ` dark ` /` light ` | - | - |
130130| theme-vars | 自定义主题变量 | ` ConfigProviderThemeVars ` | - | - | - |
131131
132+
133+ ## 外部样式类
134+
135+ | 类名 | 说明 | 最低版本 |
136+ | ------------ | ---------- | ---------------- |
137+ | custom-class | 根节点样式 | $LOWEST_VERSION$ |
138+ | custom-style | 根节点样式 | $LOWEST_VERSION$ |
Original file line number Diff line number Diff line change 11import type { ExtractPropTypes , PropType } from 'vue'
2- import { makeStringProp } from '../common/props'
2+ import { makeStringProp , baseProps } from '../common/props'
33
44export type ConfigProviderTheme = 'light' | 'dark'
55
66export const configProviderProps = {
7+ ...baseProps ,
78 /**
89 * 主题风格,设置为 dark 来开启深色模式,全局生效
910 */
Original file line number Diff line number Diff line change @@ -27,15 +27,17 @@ export default {
2727<script lang="ts" setup>
2828import { computed } from ' vue'
2929import { configProviderProps } from ' ./types'
30+ import { objToStyle } from ' ../common/util'
3031
3132const props = defineProps (configProviderProps )
3233
3334const themeClass = computed (() => {
34- return ` wot-theme-${props .theme } `
35+ return ` wot-theme-${props .theme } ${ props . customClass } `
3536})
3637
3738const themeStyle = computed (() => {
38- return mapThemeVarsToCSSVars (props .themeVars )
39+ const styleObj = mapThemeVarsToCSSVars (props .themeVars )
40+ return styleObj ? ` ${objToStyle (styleObj )};${props .customStyle } ` : props .customStyle
3941})
4042
4143const kebabCase = (str : string ): string => {
You can’t perform that action at this time.
0 commit comments