ConfigProvider
Internationalization
View Source
vue
<script setup lang="ts">
import { ref } from "vue";
import { UniEmpty, UniConfigProvider, UniButton } from "unify-ui";
const locale = ref<"en-US" | "zh-CN">("en-US");
</script>
<template>
<UniButton @click="locale = 'en-US'">locale: en-US</UniButton>
<UniButton @click="locale = 'zh-CN'">locale: zh-CN</UniButton>
<UniConfigProvider :locale="locale">
<UniEmpty></UniEmpty>
</UniConfigProvider>
</template>
API
Properties
ts
const props = withDefaults(
defineProps<{
locale?: "en-US" | "zh-CN";
fallbackLocale?: "en-US" | "zh-CN";
}>(),
{
locale: "en-US",
fallbackLocale: "en-US",
}
);
Slots
ts
defineSlots<{
default(props: {}): any;
}>();