UNPKG

tav-ui

Version:
37 lines (34 loc) 1.29 kB
import { computed } from 'vue'; import { useGlobalConfig } from '../../../../hooks/global/useGlobalConfig2.mjs'; function useGlobalConfigProps() { const globalConfigAppId = useGlobalConfig("appId").value; const globalConfigFile = useGlobalConfig("components").value; return computed(() => ({ appId: globalConfigAppId || "", ...globalConfigFile || {} })); } function useMergedProps(globalConfigProps, props, componentName, apiParamsDefault) { return computed(() => { const result = {}; const globalConfigComponentProps = globalConfigProps.value[componentName]; const globalConfigAppId = globalConfigProps.value.appId; Object.keys(props).forEach((key) => { const _p = globalConfigComponentProps && globalConfigComponentProps[key] ? globalConfigComponentProps[key] : void 0; result[key] = props[key] ?? _p; }); apiParamsDefault && Object.keys(apiParamsDefault).forEach((key) => { result["apiParams"][key] = result["apiParams"][key] ?? apiParamsDefault[key]; }); return { ...props, ...result, apiParams: { ...props.apiParams, appId: props.apiParams?.appId ?? globalConfigAppId } }; }); } export { useGlobalConfigProps, useMergedProps }; //# sourceMappingURL=use-props2.mjs.map