kui-vue
Version:
A lightweight desktop UI component library suitable for Vue.js 2.
34 lines (31 loc) • 687 B
JavaScript
import { withInstall } from "../utils/vue";
import { defineComponent, provide, ref, watch } from "vue";
const ConfigProvider = defineComponent({
name: "ConfigProvider",
props: {
locale: {
type: Object,
default: () => null,
},
// theme: {
// type: Object,
// default: () => null,
// },
},
setup(props, { slots }) {
const locale = ref(props.locale);
provide("locale", locale);
// for 2
watch(
() => props.locale,
(newVal) => {
locale.value = newVal;
},
{ immediate: true }
);
return () => {
return slots.default?.();
};
},
});
export default withInstall(ConfigProvider);