You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
566 B
36 lines
566 B
<template>
|
|
<slot />
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { provide, computed, watch } from 'vue'
|
|
import { ConfigToken } from './Token'
|
|
import { useLocale } from 'bolt-ui/locales'
|
|
import { IConfig } from './config';
|
|
|
|
const props = withDefaults(
|
|
defineProps<IConfig>(),
|
|
{
|
|
locale: 'zh'
|
|
}
|
|
)
|
|
|
|
const { setLocale } = useLocale()
|
|
|
|
watch(
|
|
() => props.locale,
|
|
(newVal) => {
|
|
setLocale(newVal)
|
|
},
|
|
{
|
|
immediate: true
|
|
}
|
|
)
|
|
|
|
const state = computed(() => {
|
|
return {
|
|
locale: props.locale ?? 'zh'
|
|
}
|
|
})
|
|
provide(ConfigToken, state)
|
|
</script>
|
|
|