config-provider
config-provider
is used to provide global configuration options, so that your configuration can be accessed globally, config-provider
uses [Vue's provide/inject feature](https://v3.vuejs .org/guide/composition-api-provide-inject.html#reactivity)
Basic usage
to set the default configuration through this component
Component size
Customize the default size of the component by modifying size
.
Component Namespace
Customize component class
name and CSS
variable name by modifying prefixCls
. (You can open the debug window to see the result).
Component token
sets the default token
of the component. By modifying token
, we can present various styles (the CSS
variable is used internally).
Component theme
<script setup lang="ts">
import { themes } from '@/index';
</script>
<template>
<v-config-provider
:themes="themes"
>
<v-space wrap>
<v-button>Default</v-button>
<v-button theme="primary">
Primary
</v-button>
<v-button theme="success">
Success
</v-button>
<v-button theme="error">
Error
</v-button>
<v-button theme="warning">
Warning
</v-button>
</v-space>
</v-config-provider>
</template>
The --demo component is not responsible for generating styles, but introduces various styles through the injected theme. You can modify the default theme according to your needs.
Set the locale
Set component default locale
API
config-provider property
property name | description | type | default value |
---|---|---|---|
size | default size | string | enum | medium |
prefix-cls | component namespace | string | v |
token | component token | Token | default token |
themes | Component themes | Themes | - |
locale | locale | Locale | - |
config-provider slot
Slot Name | Description |
---|---|
default | default slot |