mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
fix(config-provider): doesn't merge inherited theme
This commit is contained in:
parent
f171cefd3c
commit
292228dc40
@ -6,6 +6,7 @@
|
||||
|
||||
- Fix `n-dropdown` default placement is not `bottom`.
|
||||
- Fix `n-date-picker`'s input theme is not set in `date` & `datetime` type.
|
||||
- Fix `n-config-provider` doesn't merge inherited theme.
|
||||
|
||||
## 2.11.1
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
- 修复 `n-dropdown` 默认位置不是 `bottom`
|
||||
- 修复 `n-date-picker` 输入组件在 `date` & `datetime` 类型下未设定主题
|
||||
- 修复 `n-config-provider` 没有合并继承的主题
|
||||
|
||||
## 2.11.1
|
||||
|
||||
|
@ -21,9 +21,8 @@ import type {
|
||||
import type { ConfigProviderInjection } from './internal-interface'
|
||||
import { NDateLocale, NLocale } from '../../locales'
|
||||
|
||||
export const configProviderInjectionKey: InjectionKey<ConfigProviderInjection> = Symbol(
|
||||
'configProviderInjection'
|
||||
)
|
||||
export const configProviderInjectionKey: InjectionKey<ConfigProviderInjection> =
|
||||
Symbol('configProviderInjection')
|
||||
|
||||
export const configProviderProps = {
|
||||
abstract: {
|
||||
@ -110,7 +109,12 @@ export default defineComponent({
|
||||
const mergedThemeRef = computed(() => {
|
||||
const { theme } = props
|
||||
if (theme === null) return undefined
|
||||
return theme === undefined ? NConfigProvider?.mergedThemeRef.value : theme
|
||||
const inheritedTheme = NConfigProvider?.mergedThemeRef.value
|
||||
return theme === undefined
|
||||
? inheritedTheme
|
||||
: inheritedTheme === undefined
|
||||
? theme
|
||||
: Object.assign({}, inheritedTheme, theme)
|
||||
})
|
||||
const mergedThemeOverridesRef = computed(() => {
|
||||
const { themeOverrides } = props
|
||||
@ -180,7 +184,6 @@ export default defineComponent({
|
||||
const { hljs } = props
|
||||
return hljs === undefined ? NConfigProvider?.mergedHljsRef.value : hljs
|
||||
}),
|
||||
// wip, unstable
|
||||
mergedThemeRef,
|
||||
mergedThemeOverridesRef,
|
||||
// deprecated
|
||||
|
Loading…
Reference in New Issue
Block a user