Closed echoOikawa closed 1 month ago
🎨 Enhance
支持 GISDK 传入额外的 props 额外props 格式约定为:
interface GISDKProps { / ** 全局额外参数 */ GISDKExtraParams?: Record<string, any>; /** 资产额外参数,以资产ID为 key, value 为传入对应资产的 props */ componentExtraParams?: Record<string, any>; }
比如:
const GISDKExtraParams = { GI_AKG_AGENT_CONTEXT: { id: 7, agentCode: 'e690b81f43' } }; const componentExtraParams = { // 传给 ToolBar 组件的 props Toolbar: { test: 123, test2: 'abc' } }
使用在对应的资产中进行读取:
const context = useContext(); const { direction, components, assets, placement, offset, ...extraProps ...extraProps } = props; console.log({ // 从 context 中读取存入全局的 extraParams contextExtraProps: context.extraParams, // 读取传给对应资产的 额外 props componentExtraProps: extraProps });
验证
🎨 Enhance
📝 Description
支持 GISDK 传入额外的 props 额外props 格式约定为:
比如:
使用在对应的资产中进行读取:
验证
🔍 Self-Check before the merge