xph-form
Version:
This is a configurable form component that supports React
13 lines (12 loc) • 574 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import React, { createContext, useContext } from "react";
export const ExtendCompPropsContext = createContext({});
export const ExtendCompPropsProvider = (props) => {
const { extendProps, extendComp } = props.value;
return (_jsx(ExtendCompPropsContext.Provider, { value: {
extendProps,
extendComp,
}, children: props.children }));
};
/** 提供给使用方来扩展xph的组件/给组件提供默认属性 */
export const useExtendCompProps = () => useContext(ExtendCompPropsContext);