From ac31116c3bcc694e89ade9f43aaa5afb74541e99 Mon Sep 17 00:00:00 2001 From: zz <2418184580@qq.com> Date: Mon, 30 May 2022 10:33:49 +0800 Subject: [PATCH] refactor(components): [config-provider] export component instance type (#7979) --- .../config-provider/src/config-provider.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/components/config-provider/src/config-provider.ts b/packages/components/config-provider/src/config-provider.ts index 365f7cc2ce..2c9b7b2bf0 100644 --- a/packages/components/config-provider/src/config-provider.ts +++ b/packages/components/config-provider/src/config-provider.ts @@ -1,8 +1,7 @@ import { defineComponent, renderSlot, watch } from 'vue' import { buildProps, definePropType } from '@element-plus/utils' -import { provideGlobalConfig } from '@element-plus/hooks' +import { provideGlobalConfig, useSizeProp } from '@element-plus/hooks' -import { componentSizes } from '@element-plus/constants' import type { ExtractPropTypes } from 'vue' import type { ExperimentalFeatures } from '@element-plus/tokens' import type { Language } from '@element-plus/locale' @@ -22,11 +21,7 @@ export const configProviderProps = buildProps({ type: definePropType(Object), }, - size: { - type: String, - values: componentSizes, - default: '', - }, + size: useSizeProp, button: { type: definePropType(Object), @@ -46,17 +41,16 @@ export const configProviderProps = buildProps({ type: definePropType(Object), }, - zIndex: { - type: Number, - }, + zIndex: Number, namespace: { type: String, default: 'el', }, } as const) +export type ConfigProviderProps = ExtractPropTypes -export default defineComponent({ +const ConfigProvider = defineComponent({ name: 'ElConfigProvider', props: configProviderProps, @@ -72,5 +66,6 @@ export default defineComponent({ return () => renderSlot(slots, 'default', { config: config?.value }) }, }) +export type ConfigProviderInstance = InstanceType -export type ConfigProviderProps = ExtractPropTypes +export default ConfigProvider