config-provider.mjs 914 B

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