UNPKG

yanzhen-design-vue

Version:

28 lines (27 loc) 562 B
import { computed } from "vue"; import { pick, mergeWith } from "lodash-es"; const defaultPreviewConfig = () => { return { preview: true }; }; function usePreviewConfig(props) { const previewConfig = computed(() => { const previewConfig2 = defaultPreviewConfig(); const config = pick( { ...props, ...props.previewConfig ?? {} }, ...Object.keys(previewConfig2) ); return mergeWith(previewConfig2, config); }); return { previewConfig }; } export { defaultPreviewConfig, usePreviewConfig };