config-provider.mjs 833 B

1234567891011121314151617181920212223
  1. import { provideGlobalConfig } from "./hooks/use-global-config.mjs";
  2. import { configProviderProps } from "./config-provider-props.mjs";
  3. import { defineComponent, renderSlot, watch } from "vue";
  4. //#region ../../packages/components/config-provider/src/config-provider.ts
  5. const messageConfig = { placement: "top" };
  6. const ConfigProvider = defineComponent({
  7. name: "ElConfigProvider",
  8. props: configProviderProps,
  9. setup(props, { slots }) {
  10. const config = provideGlobalConfig(props);
  11. watch(() => props.message, (val) => {
  12. Object.assign(messageConfig, config?.value?.message ?? {}, val ?? {});
  13. }, {
  14. immediate: true,
  15. deep: true
  16. });
  17. return () => renderSlot(slots, "default", { config: config?.value });
  18. }
  19. });
  20. //#endregion
  21. export { ConfigProvider as default, messageConfig };
  22. //# sourceMappingURL=config-provider.mjs.map