mirror of
				https://github.com/antd-tiny-vue/antd-tiny-vue.git
				synced 2025-11-01 01:01:44 +08:00 
			
		
		
		
	feat: add theme and style
This commit is contained in:
		
							
								
								
									
										28
									
								
								components/config-provider/context.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								components/config-provider/context.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| import { createInjectionState } from '@vueuse/core' | ||||
| import { computed } from 'vue' | ||||
|  | ||||
| export const defaultIconPrefixCls = 'anticon' | ||||
|  | ||||
| const defaultGetPrefixCls = (suffixCls?: string, customizePrefixCls?: string) => { | ||||
|   if (customizePrefixCls) return customizePrefixCls | ||||
|  | ||||
|   return suffixCls ? `ant-${suffixCls}` : 'ant' | ||||
| } | ||||
| const [useProviderConfigProvide, useProviderConfigInject] = createInjectionState(() => { | ||||
|   const getPrefixCls = defaultGetPrefixCls | ||||
|   const iconPrefixCls = computed(() => defaultIconPrefixCls) | ||||
|   return { | ||||
|     getPrefixCls, | ||||
|     iconPrefixCls | ||||
|   } | ||||
| }) | ||||
|  | ||||
| export { useProviderConfigProvide } | ||||
| export const useProviderConfigState = () => { | ||||
|   return ( | ||||
|     useProviderConfigInject() ?? { | ||||
|       getPrefixCls: defaultGetPrefixCls, | ||||
|       iconPrefixCls: computed(() => defaultIconPrefixCls) | ||||
|     } | ||||
|   ) | ||||
| } | ||||
		Reference in New Issue
	
	Block a user